libpkgconf: do not implicitly build the dir list, instead explicitly do it

pull/100/head
William Pitcock 2016-12-01 15:17:23 -06:00
parent ad731d1948
commit a300787cef
3 changed files with 5 additions and 6 deletions

View File

@ -202,7 +202,7 @@ pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name)
pkgconf_pkg_t *pkgconf_builtin_pkg_get(const char *name);
int pkgconf_compare_version(const char *a, const char *b);
pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
pkgconf_pkg_t *pkgconf_scan_all(const pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
void pkgconf_pkg_dir_list_build(pkgconf_client_t *client, unsigned int flags);
/* parse.c */

View File

@ -392,13 +392,11 @@ out:
}
pkgconf_pkg_t *
pkgconf_scan_all(pkgconf_client_t *client, void *data, pkgconf_pkg_iteration_func_t func)
pkgconf_scan_all(const pkgconf_client_t *client, void *data, pkgconf_pkg_iteration_func_t func)
{
pkgconf_node_t *n;
pkgconf_pkg_t *pkg;
pkgconf_pkg_dir_list_build(client, 0);
PKGCONF_FOREACH_LIST_ENTRY(client->dir_list.head, n)
{
pkgconf_path_t *pnode = n->data;
@ -455,8 +453,6 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name, unsigned int flags)
pkgconf_node_t *n;
FILE *f;
pkgconf_pkg_dir_list_build(client, flags);
/* name might actually be a filename. */
if (str_has_suffix(name, PKG_CONFIG_EXT))
{

3
main.c
View File

@ -824,6 +824,9 @@ main(int argc, char *argv[])
else
pkgconf_tuple_add_global(&pkg_client, "pc_sysrootdir", "/");
/* at this point, global_traverse_flags should be set, so build the dir list */
pkgconf_pkg_dir_list_build(&pkg_client, global_traverse_flags);
if (required_pkgconfig_version != NULL)
{
if (pkgconf_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0)