summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2013-04-17 07:56:19 -0700
committerDan Nicholson <dbn.lists@gmail.com>2013-05-17 05:13:14 -0700
commitf655cf91a011e85f1d2988702862d3a70b7de834 (patch)
tree574873cacba538cb3a2552d6a99ea9cd9626922e
parenta65d5cff5fdc842b9567d56771193820ae48b7b7 (diff)
downloadpkg-config-f655cf91a011e85f1d2988702862d3a70b7de834.tar.gz
Store the original prefix value in the package
Avoids making implicit assumptions about parse ordering needed to store the original prefix as a static file local variable.
-rw-r--r--parse.c16
-rw-r--r--pkg.h3
2 files changed, 10 insertions, 9 deletions
diff --git a/parse.c b/parse.c
index 6c48e94..2809735 100644
--- a/parse.c
+++ b/parse.c
@@ -855,10 +855,6 @@ parse_url (Package *pkg, const char *str, const char *path)
pkg->url = trim_and_sub (pkg, str, path);
}
-#ifdef G_OS_WIN32
-static char *orig_prefix = NULL;
-#endif
-
static void
parse_line (Package *pkg, const char *untrimmed, const char *path,
gboolean ignore_requires, gboolean ignore_private_libs,
@@ -971,7 +967,8 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
gchar *q;
gchar *prefix;
- orig_prefix = g_strdup (p);
+ /* Keep track of the original prefix value. */
+ pkg->orig_prefix = g_strdup (p);
/* Get grandparent directory for new prefix. */
q = g_path_get_dirname (pkg->pcfiledir);
@@ -1005,13 +1002,14 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
}
}
else if (define_prefix &&
- orig_prefix != NULL &&
- strncmp (p, orig_prefix, strlen (orig_prefix)) == 0 &&
- G_IS_DIR_SEPARATOR (p[strlen (orig_prefix)]))
+ pkg->orig_prefix != NULL &&
+ strncmp (p, pkg->orig_prefix, strlen (pkg->orig_prefix)) == 0 &&
+ G_IS_DIR_SEPARATOR (p[strlen (pkg->orig_prefix)]))
{
char *oldstr = str;
- p = str = g_strconcat (g_hash_table_lookup (pkg->vars, prefix_variable), p + strlen (orig_prefix), NULL);
+ p = str = g_strconcat (g_hash_table_lookup (pkg->vars, prefix_variable),
+ p + strlen (pkg->orig_prefix), NULL);
g_free (oldstr);
}
#endif
diff --git a/pkg.h b/pkg.h
index 74687dc..fe50e87 100644
--- a/pkg.h
+++ b/pkg.h
@@ -85,6 +85,9 @@ struct _Package
int libs_num; /* Number of times the "Libs" header has been seen */
int libs_private_num; /* Number of times the "Libs.private" header has been seen */
gboolean in_requires_chain; /* package is in current Requires chain */
+#ifdef G_OS_WIN32
+ char *orig_prefix; /* original prefix value before redefinition */
+#endif
};
Package *get_package (const char *name);