Handle pcfiledir variable like normal variable

Rather than responding to the pcfiledir variable specially, store it
in the hash table with all the other package specific variables. This
does result in pcfiledir showing up in the --print-variables output.
This commit is contained in:
Dan Nicholson 2014-02-10 08:04:31 -08:00 committed by Dan Nicholson
parent 30437b47c8
commit 9294307b21
3 changed files with 10 additions and 10 deletions

View file

@ -12,13 +12,14 @@ RESULT=1.0.0
run_test --modversion simple
# --print-variables, make sure having no variables doesn't crash
RESULT=""
RESULT="pcfiledir"
run_test --print-variables no-variables
RESULT="exec_prefix
prefix
libdir
includedir"
includedir
pcfiledir"
run_test --print-variables simple
# --print-provides

11
parse.c
View file

@ -990,9 +990,6 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
++p;
while (*p && isspace ((guchar)*p))
++p;
if (pkg->vars == NULL)
pkg->vars = g_hash_table_new (g_str_hash, g_str_equal);
if (define_prefix && strcmp (tag, prefix_variable) == 0)
{
@ -1114,7 +1111,13 @@ parse_package_file (const char *path, gboolean ignore_requires,
debug_spew ("No pcfiledir determined for package\n");
pkg->pcfiledir = g_strdup ("???????");
}
if (pkg->vars == NULL)
pkg->vars = g_hash_table_new (g_str_hash, g_str_equal);
/* Variable storing directory of pc file */
g_hash_table_insert (pkg->vars, "pcfiledir", pkg->pcfiledir);
str = g_string_new ("");
while (read_one_line (f, str))

4
pkg.c
View file

@ -1028,10 +1028,6 @@ package_get_var (Package *pkg,
if (varval == NULL && pkg->vars)
varval = g_strdup (g_hash_table_lookup (pkg->vars, var));
/* Magic "pcfiledir" variable */
if (varval == NULL && pkg->pcfiledir && strcmp (var, "pcfiledir") == 0)
varval = g_strdup (pkg->pcfiledir);
return varval;
}