Revert "pkgconf_pkg_parser_value_set(): fix code-path ordering bug."

This reverts commit 13fe4c8c58.
master
Ariadne Conill 2022-06-26 19:41:31 +00:00
parent b602e33141
commit b0802cb3d1
1 changed files with 4 additions and 6 deletions

View File

@ -305,11 +305,7 @@ pkgconf_pkg_parser_value_set(void *opaque, const size_t lineno, const char *keyw
* which is broken when redefining the prefix. We try to outsmart the * which is broken when redefining the prefix. We try to outsmart the
* file and rewrite any directory that starts with the same prefix. * file and rewrite any directory that starts with the same prefix.
*/ */
if (strcmp(keyword, pkg->owner->prefix_varname) || !(pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX)) if (pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX && pkg->orig_prefix
{
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true);
}
else if (pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX && pkg->orig_prefix
&& is_path_prefix_equal(canonicalized_value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value))) && is_path_prefix_equal(canonicalized_value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value)))
{ {
char newvalue[PKGCONF_ITEM_SIZE]; char newvalue[PKGCONF_ITEM_SIZE];
@ -318,6 +314,8 @@ pkgconf_pkg_parser_value_set(void *opaque, const size_t lineno, const char *keyw
pkgconf_strlcat(newvalue, canonicalized_value + strlen(pkg->orig_prefix->value), sizeof newvalue); pkgconf_strlcat(newvalue, canonicalized_value + strlen(pkg->orig_prefix->value), sizeof newvalue);
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, newvalue, false); pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, newvalue, false);
} }
else if (strcmp(keyword, pkg->owner->prefix_varname) || !(pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX))
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true);
else else
{ {
char pathbuf[PKGCONF_ITEM_SIZE]; char pathbuf[PKGCONF_ITEM_SIZE];
@ -327,7 +325,7 @@ pkgconf_pkg_parser_value_set(void *opaque, const size_t lineno, const char *keyw
{ {
char *prefix_value = convert_path_to_value(relvalue); char *prefix_value = convert_path_to_value(relvalue);
pkg->orig_prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, "orig_prefix", canonicalized_value, true); pkg->orig_prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, "orig_prefix", canonicalized_value, true);
pkgconf_tuple_add_global(pkg->owner, keyword, prefix_value); pkg->prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, prefix_value, false);
free(prefix_value); free(prefix_value);
} }
else else