Do not parse the global variables

This fixes an incompatibility with pkg-confing 0.29
Found by Thomas Klausner <wiz@NetBSD.org> when building gupnp-igd-0.2.3
with introspection support
feature/tap-sh
Baptiste Daroussin 2015-12-08 00:02:14 +01:00
parent 32bd6bd700
commit 1fe91b914c
3 changed files with 24 additions and 12 deletions

View File

@ -182,7 +182,7 @@ void pkgconf_fragment_free(pkgconf_list_t *list);
char *pkgconf_fgetline(char *line, size_t size, FILE *stream); char *pkgconf_fgetline(char *line, size_t size, FILE *stream);
/* tuple.c */ /* tuple.c */
pkgconf_tuple_t *pkgconf_tuple_add(pkgconf_list_t *parent, const char *key, const char *value); pkgconf_tuple_t *pkgconf_tuple_add(pkgconf_list_t *parent, const char *key, const char *value, bool parse);
char *pkgconf_tuple_find(pkgconf_list_t *list, const char *key); char *pkgconf_tuple_find(pkgconf_list_t *list, const char *key);
char *pkgconf_tuple_parse(pkgconf_list_t *list, const char *value); char *pkgconf_tuple_parse(pkgconf_list_t *list, const char *value);
void pkgconf_tuple_free(pkgconf_list_t *list); void pkgconf_tuple_free(pkgconf_list_t *list);

View File

@ -208,7 +208,7 @@ pkgconf_pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
pkg = calloc(sizeof(pkgconf_pkg_t), 1); pkg = calloc(sizeof(pkgconf_pkg_t), 1);
pkg->filename = strdup(filename); pkg->filename = strdup(filename);
pkgconf_tuple_add(&pkg->vars, "pcfiledir", pkg_get_parent_dir(pkg)); pkgconf_tuple_add(&pkg->vars, "pcfiledir", pkg_get_parent_dir(pkg), true);
/* make module id */ /* make module id */
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL) if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
@ -273,7 +273,7 @@ pkgconf_pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
pkgconf_dependency_parse(pkg, &pkg->conflicts, value); pkgconf_dependency_parse(pkg, &pkg->conflicts, value);
break; break;
case '=': case '=':
pkgconf_tuple_add(&pkg->vars, key, value); pkgconf_tuple_add(&pkg->vars, key, value, true);
break; break;
default: default:
break; break;

View File

@ -20,7 +20,7 @@ static pkgconf_list_t pkg_global_var = PKGCONF_LIST_INITIALIZER;
void void
pkgconf_tuple_add_global(const char *key, const char *value) pkgconf_tuple_add_global(const char *key, const char *value)
{ {
pkgconf_tuple_add(&pkg_global_var, key, value); pkgconf_tuple_add(&pkg_global_var, key, value, false);
} }
char * char *
@ -62,12 +62,15 @@ out:
} }
pkgconf_tuple_t * pkgconf_tuple_t *
pkgconf_tuple_add(pkgconf_list_t *list, const char *key, const char *value) pkgconf_tuple_add(pkgconf_list_t *list, const char *key, const char *value, bool parse)
{ {
pkgconf_tuple_t *tuple = calloc(sizeof(pkgconf_tuple_t), 1); pkgconf_tuple_t *tuple = calloc(sizeof(pkgconf_tuple_t), 1);
tuple->key = strdup(key); tuple->key = strdup(key);
tuple->value = pkgconf_tuple_parse(list, value); if (parse)
tuple->value = pkgconf_tuple_parse(list, value);
else
tuple->value = strdup(value);
pkgconf_node_insert(&tuple->iter, tuple, list); pkgconf_node_insert(&tuple->iter, tuple, list);
@ -126,16 +129,25 @@ pkgconf_tuple_parse(pkgconf_list_t *vars, const char *value)
} }
ptr += (pptr - ptr); ptr += (pptr - ptr);
kv = pkgconf_tuple_find(vars, varname); kv = pkgconf_tuple_find_global(varname);
if (kv != NULL) if (kv != NULL)
{ {
parsekv = pkgconf_tuple_parse(vars, kv); strncpy(bptr, kv, PKGCONF_BUFSIZE - (bptr - buf));
bptr += strlen(kv);
}
else
{
kv = pkgconf_tuple_find(vars, varname);
strncpy(bptr, parsekv, PKGCONF_BUFSIZE - (bptr - buf)); if (kv != NULL)
bptr += strlen(parsekv); {
parsekv = pkgconf_tuple_parse(vars, kv);
free(parsekv); strncpy(bptr, parsekv, PKGCONF_BUFSIZE - (bptr - buf));
bptr += strlen(parsekv);
free(parsekv);
}
} }
} }
} }