forked from ariadne/pkgconf
libpkgconf: fragment: simplify sysroot handling by using pkgconf_client_t.sysroot_dir presence
parent
792cd7c8e6
commit
a902203054
|
@ -85,23 +85,20 @@ pkgconf_fragment_munge(const pkgconf_client_t *client, char *buf, size_t buflen,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
pkgconf_fragment_copy_munged(const pkgconf_client_t *client, const char *source, unsigned int flags)
|
pkgconf_fragment_copy_munged(const pkgconf_client_t *client, const char *source)
|
||||||
{
|
{
|
||||||
char mungebuf[PKGCONF_BUFSIZE];
|
char mungebuf[PKGCONF_BUFSIZE];
|
||||||
char *sysroot_dir;
|
|
||||||
|
|
||||||
if (!(flags & PKGCONF_PKG_PKGF_MUNGE_SYSROOT_PREFIX))
|
if (client->sysroot_dir == NULL)
|
||||||
return strdup(source);
|
return strdup(source);
|
||||||
|
|
||||||
sysroot_dir = pkgconf_tuple_find_global(client, "pc_sysrootdir");
|
pkgconf_fragment_munge(client, mungebuf, sizeof mungebuf, source, client->sysroot_dir);
|
||||||
|
|
||||||
pkgconf_fragment_munge(client, mungebuf, sizeof mungebuf, source, sysroot_dir);
|
|
||||||
|
|
||||||
return strdup(mungebuf);
|
return strdup(mungebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags)
|
pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string)
|
||||||
{
|
{
|
||||||
pkgconf_fragment_t *frag;
|
pkgconf_fragment_t *frag;
|
||||||
|
|
||||||
|
@ -113,7 +110,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
|
||||||
frag = calloc(sizeof(pkgconf_fragment_t), 1);
|
frag = calloc(sizeof(pkgconf_fragment_t), 1);
|
||||||
|
|
||||||
frag->type = *(string + 1);
|
frag->type = *(string + 1);
|
||||||
frag->data = pkgconf_fragment_copy_munged(client, string + 2, flags);
|
frag->data = pkgconf_fragment_copy_munged(client, string + 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -260,7 +257,7 @@ pkgconf_fragment_free(pkgconf_list_t *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
||||||
{
|
{
|
||||||
int i, argc;
|
int i, argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
@ -269,7 +266,7 @@ pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkg
|
||||||
pkgconf_argv_split(repstr, &argc, &argv);
|
pkgconf_argv_split(repstr, &argc, &argv);
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
pkgconf_fragment_add(client, list, argv[i], flags);
|
pkgconf_fragment_add(client, list, argv[i]);
|
||||||
|
|
||||||
pkgconf_argv_free(argv);
|
pkgconf_argv_free(argv);
|
||||||
free(repstr);
|
free(repstr);
|
||||||
|
|
|
@ -228,8 +228,8 @@ int pkgconf_argv_split(const char *src, int *argc, char ***argv);
|
||||||
void pkgconf_argv_free(char **argv);
|
void pkgconf_argv_free(char **argv);
|
||||||
|
|
||||||
/* fragment.c */
|
/* fragment.c */
|
||||||
void pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value, unsigned int flags);
|
void pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value);
|
||||||
void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags);
|
void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string);
|
||||||
void pkgconf_fragment_copy(pkgconf_list_t *list, pkgconf_fragment_t *base, unsigned int flags, bool is_private);
|
void pkgconf_fragment_copy(pkgconf_list_t *list, pkgconf_fragment_t *base, unsigned int flags, bool is_private);
|
||||||
void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
||||||
void pkgconf_fragment_free(pkgconf_list_t *list);
|
void pkgconf_fragment_free(pkgconf_list_t *list);
|
||||||
|
|
|
@ -145,7 +145,9 @@ static void
|
||||||
pkgconf_pkg_parser_fragment_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value, unsigned int flags)
|
pkgconf_pkg_parser_fragment_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkgconf_list_t *dest = ((void *) pkg + offset);
|
pkgconf_list_t *dest = ((void *) pkg + offset);
|
||||||
pkgconf_fragment_parse(client, dest, &pkg->vars, value, flags);
|
(void) flags;
|
||||||
|
|
||||||
|
pkgconf_fragment_parse(client, dest, &pkg->vars, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue