libpkgconf: untangle remaining pkg_ functions related to pkgconf_pkg_t

feature/tap-sh
William Pitcock 2015-09-06 11:20:48 -05:00
parent 0d145ef85a
commit ca1b02659a
6 changed files with 166 additions and 188 deletions

View File

@ -24,17 +24,17 @@ static pkgconf_list_t pkg_cache = PKGCONF_LIST_INITIALIZER;
* such as 'gtk+-3.0' and returns the already loaded version * such as 'gtk+-3.0' and returns the already loaded version
* if present. * if present.
*/ */
pkg_t * pkgconf_pkg_t *
pkgconf_cache_lookup(const char *id) pkgconf_cache_lookup(const char *id)
{ {
pkgconf_node_t *node; pkgconf_node_t *node;
PKGCONF_FOREACH_LIST_ENTRY(pkg_cache.head, node) PKGCONF_FOREACH_LIST_ENTRY(pkg_cache.head, node)
{ {
pkg_t *pkg = node->data; pkgconf_pkg_t *pkg = node->data;
if (!strcmp(pkg->id, id)) if (!strcmp(pkg->id, id))
return pkg_ref(pkg); return pkgconf_pkg_ref(pkg);
} }
return NULL; return NULL;
@ -47,13 +47,12 @@ pkgconf_cache_lookup(const char *id)
* the cache entry must be removed if the package is freed. * the cache entry must be removed if the package is freed.
*/ */
void void
pkgconf_cache_add(pkg_t *pkg) pkgconf_cache_add(pkgconf_pkg_t *pkg)
{ {
if (pkg == NULL) if (pkg == NULL)
return; return;
pkg_ref(pkg); pkgconf_pkg_ref(pkg);
pkgconf_node_insert(&pkg->cache_iter, pkg, &pkg_cache); pkgconf_node_insert(&pkg->cache_iter, pkg, &pkg_cache);
} }
@ -63,7 +62,7 @@ pkgconf_cache_add(pkg_t *pkg)
* deletes a package from the cache entry. * deletes a package from the cache entry.
*/ */
void void
pkgconf_cache_remove(pkg_t *pkg) pkgconf_cache_remove(pkgconf_pkg_t *pkg)
{ {
if (pkg == NULL) if (pkg == NULL)
return; return;
@ -78,8 +77,7 @@ pkgconf_cache_free(void)
PKGCONF_FOREACH_LIST_ENTRY_SAFE(pkg_cache.head, iter2, iter) PKGCONF_FOREACH_LIST_ENTRY_SAFE(pkg_cache.head, iter2, iter)
{ {
pkg_t *pkg = iter->data; pkgconf_pkg_t *pkg = iter->data;
pkgconf_pkg_free(pkg);
pkg_free(pkg);
} }
} }

View File

@ -223,7 +223,7 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends)
} }
void void
pkgconf_dependency_parse(pkg_t *pkg, pkgconf_list_t *deplist, const char *depends) pkgconf_dependency_parse(pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)
{ {
char *kvdepends = pkgconf_tuple_parse(&pkg->vars, depends); char *kvdepends = pkgconf_tuple_parse(&pkg->vars, depends);

View File

@ -35,7 +35,7 @@ typedef enum {
PKG_CMP_SIZE PKG_CMP_SIZE
} pkgconf_pkg_comparator_t; } pkgconf_pkg_comparator_t;
typedef struct pkg_ pkg_t; typedef struct pkgconf_pkg_ pkgconf_pkg_t;
typedef struct pkgconf_dependency_ pkgconf_dependency_t; typedef struct pkgconf_dependency_ pkgconf_dependency_t;
typedef struct pkgconf_tuple_ pkgconf_tuple_t; typedef struct pkgconf_tuple_ pkgconf_tuple_t;
typedef struct pkgconf_fragment_ pkgconf_fragment_t; typedef struct pkgconf_fragment_ pkgconf_fragment_t;
@ -65,7 +65,7 @@ struct pkgconf_dependency_ {
char *package; char *package;
pkgconf_pkg_comparator_t compare; pkgconf_pkg_comparator_t compare;
char *version; char *version;
pkg_t *parent; pkgconf_pkg_t *parent;
}; };
struct pkgconf_tuple_ { struct pkgconf_tuple_ {
@ -81,7 +81,7 @@ struct pkgconf_tuple_ {
#define PKG_PROPF_SEEN 0x4 #define PKG_PROPF_SEEN 0x4
#define PKG_PROPF_UNINSTALLED 0x8 #define PKG_PROPF_UNINSTALLED 0x8
struct pkg_ { struct pkgconf_pkg_ {
pkgconf_node_t cache_iter; pkgconf_node_t cache_iter;
int refcount; int refcount;
@ -128,30 +128,30 @@ struct pkg_ {
#define PKG_ERRF_PACKAGE_CONFLICT 0x4 #define PKG_ERRF_PACKAGE_CONFLICT 0x4
#define PKG_ERRF_DEPGRAPH_BREAK 0x8 #define PKG_ERRF_DEPGRAPH_BREAK 0x8
typedef void (*pkg_iteration_func_t)(const pkg_t *pkg); typedef void (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg);
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags); typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_pkg_t *pkg, void *data, unsigned int flags);
typedef bool (*pkgconf_queue_apply_func_t)(pkg_t *world, void *data, int maxdepth, unsigned int flags); typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_pkg_t *world, void *data, int maxdepth, unsigned int flags);
/* pkg.c */ /* pkg.c */
pkg_t *pkg_ref(pkg_t *pkg); pkgconf_pkg_t *pkgconf_pkg_ref(pkgconf_pkg_t *pkg);
void pkg_unref(pkg_t *pkg); void pkgconf_pkg_unref(pkgconf_pkg_t *pkg);
void pkg_free(pkg_t *pkg); void pkgconf_pkg_free(pkgconf_pkg_t *pkg);
pkg_t *pkg_find(const char *name, unsigned int flags); pkgconf_pkg_t *pkgconf_pkg_find(const char *name, unsigned int flags);
unsigned int pkg_traverse(pkg_t *root, pkg_traverse_func_t func, void *data, int maxdepth, unsigned int flags); unsigned int pkgconf_pkg_traverse(pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth, unsigned int flags);
unsigned int pkg_verify_graph(pkg_t *root, int depth, unsigned int flags); unsigned int pkgconf_pkg_verify_graph(pkgconf_pkg_t *root, int depth, unsigned int flags);
pkg_t *pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags); pkgconf_pkg_t *pkgconf_pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags);
const char *pkgconf_pkg_get_comparator(pkgconf_dependency_t *pkgdep); const char *pkgconf_pkg_get_comparator(pkgconf_dependency_t *pkgdep);
int pkg_cflags(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags); int pkgconf_pkg_cflags(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
int pkg_libs(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags); int pkgconf_pkg_libs(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name); pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name);
int pkgconf_compare_version(const char *a, const char *b); int pkgconf_compare_version(const char *a, const char *b);
void pkgconf_scan_all(pkg_iteration_func_t func); void pkgconf_scan_all(pkgconf_pkg_iteration_func_t func);
/* parse.c */ /* parse.c */
pkg_t *pkg_new_from_file(const char *path, FILE *f, unsigned int flags); pkgconf_pkg_t *pkgconf_pkg_new_from_file(const char *path, FILE *f, unsigned int flags);
void pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends); void pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends);
void pkgconf_dependency_parse(pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends); void pkgconf_dependency_parse(pkgconf_pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends);
void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail); void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail);
void pkgconf_dependency_free(pkgconf_list_t *list); void pkgconf_dependency_free(pkgconf_list_t *list);
@ -184,15 +184,15 @@ extern FILE *error_msgout;
/* queue.c */ /* queue.c */
void pkgconf_queue_push(pkgconf_list_t *list, const char *package); void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
bool pkgconf_queue_compile(pkg_t *world, pkgconf_list_t *list); bool pkgconf_queue_compile(pkgconf_pkg_t *world, pkgconf_list_t *list);
void pkgconf_queue_free(pkgconf_list_t *list); void pkgconf_queue_free(pkgconf_list_t *list);
bool pkgconf_queue_apply(pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data); bool pkgconf_queue_apply(pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data);
bool pkgconf_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags); bool pkgconf_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags);
/* cache.c */ /* cache.c */
pkg_t *pkgconf_cache_lookup(const char *id); pkgconf_pkg_t *pkgconf_cache_lookup(const char *id);
void pkgconf_cache_add(pkg_t *pkg); void pkgconf_cache_add(pkgconf_pkg_t *pkg);
void pkgconf_cache_remove(pkg_t *pkg); void pkgconf_cache_remove(pkgconf_pkg_t *pkg);
void pkgconf_cache_free(void); void pkgconf_cache_free(void);
#endif #endif

View File

@ -74,20 +74,6 @@ path_split(const char *text, pkgconf_list_t *dirlist)
return count; return count;
} }
static inline void
path_free(pkgconf_list_t *dirlist)
{
pkgconf_node_t *n, *tn;
PKGCONF_FOREACH_LIST_ENTRY_SAFE(dirlist->head, tn, n)
{
pkg_path_t *pkg_path = n->data;
free(pkg_path->path);
free(pkg_path);
}
}
static inline bool static inline bool
str_has_suffix(const char *str, const char *suffix) str_has_suffix(const char *str, const char *suffix)
{ {
@ -142,7 +128,7 @@ get_pkgconfig_path(void)
} }
static const char * static const char *
pkg_get_parent_dir(pkg_t *pkg) pkg_get_parent_dir(pkgconf_pkg_t *pkg)
{ {
static char buf[PKG_BUFSIZE]; static char buf[PKG_BUFSIZE];
char *pathbuf; char *pathbuf;
@ -159,8 +145,8 @@ pkg_get_parent_dir(pkg_t *pkg)
static pkgconf_list_t pkg_dir_list = PKGCONF_LIST_INITIALIZER; static pkgconf_list_t pkg_dir_list = PKGCONF_LIST_INITIALIZER;
void static void
pkg_dir_list_build(unsigned int flags) pkgconf_pkg_dir_list_build(unsigned int flags)
{ {
const char *env_path; const char *env_path;
@ -179,25 +165,19 @@ pkg_dir_list_build(unsigned int flags)
} }
} }
void
pkg_dir_list_free(void)
{
path_free(&pkg_dir_list);
}
/* /*
* pkg_new_from_file(filename, file, flags) * pkgconf_pkg_new_from_file(filename, file, flags)
* *
* Parse a .pc file into a pkg_t object structure. * Parse a .pc file into a pkgconf_pkg_t object structure.
*/ */
pkg_t * pkgconf_pkg_t *
pkg_new_from_file(const char *filename, FILE *f, unsigned int flags) pkgconf_pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
char readbuf[PKG_BUFSIZE]; char readbuf[PKG_BUFSIZE];
char *idptr; char *idptr;
pkg = calloc(sizeof(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));
@ -272,11 +252,11 @@ pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
} }
fclose(f); fclose(f);
return pkg_ref(pkg); return pkgconf_pkg_ref(pkg);
} }
void void
pkg_free(pkg_t *pkg) pkgconf_pkg_free(pkgconf_pkg_t *pkg)
{ {
if (pkg == NULL || pkg->flags & PKG_PROPF_VIRTUAL) if (pkg == NULL || pkg->flags & PKG_PROPF_VIRTUAL)
return; return;
@ -318,25 +298,25 @@ pkg_free(pkg_t *pkg)
free(pkg); free(pkg);
} }
pkg_t * pkgconf_pkg_t *
pkg_ref(pkg_t *pkg) pkgconf_pkg_ref(pkgconf_pkg_t *pkg)
{ {
pkg->refcount++; pkg->refcount++;
return pkg; return pkg;
} }
void void
pkg_unref(pkg_t *pkg) pkgconf_pkg_unref(pkgconf_pkg_t *pkg)
{ {
pkg->refcount--; pkg->refcount--;
if (pkg->refcount <= 0) if (pkg->refcount <= 0)
pkg_free(pkg); pkgconf_pkg_free(pkg);
} }
static inline pkg_t * static inline pkgconf_pkg_t *
pkg_try_specific_path(const char *path, const char *name, unsigned int flags) pkgconf_pkg_try_specific_path(const char *path, const char *name, unsigned int flags)
{ {
pkg_t *pkg = NULL; pkgconf_pkg_t *pkg = NULL;
FILE *f; FILE *f;
char locbuf[PKG_CONFIG_PATH_SZ]; char locbuf[PKG_CONFIG_PATH_SZ];
char uninst_locbuf[PKG_CONFIG_PATH_SZ]; char uninst_locbuf[PKG_CONFIG_PATH_SZ];
@ -346,17 +326,17 @@ pkg_try_specific_path(const char *path, const char *name, unsigned int flags)
if (!(flags & PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL) if (!(flags & PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL)
{ {
pkg = pkg_new_from_file(uninst_locbuf, f, flags); pkg = pkgconf_pkg_new_from_file(uninst_locbuf, f, flags);
pkg->flags |= PKG_PROPF_UNINSTALLED; pkg->flags |= PKG_PROPF_UNINSTALLED;
} }
else if ((f = fopen(locbuf, "r")) != NULL) else if ((f = fopen(locbuf, "r")) != NULL)
pkg = pkg_new_from_file(locbuf, f, flags); pkg = pkgconf_pkg_new_from_file(locbuf, f, flags);
return pkg; return pkg;
} }
static void static void
pkg_scan_dir(const char *path, pkg_iteration_func_t func) pkgconf_pkg_scan_dir(const char *path, pkgconf_pkg_iteration_func_t func)
{ {
DIR *dir; DIR *dir;
struct dirent *dirent; struct dirent *dirent;
@ -368,7 +348,7 @@ pkg_scan_dir(const char *path, pkg_iteration_func_t func)
for (dirent = readdir(dir); dirent != NULL; dirent = readdir(dir)) for (dirent = readdir(dir); dirent != NULL; dirent = readdir(dir))
{ {
static char filebuf[PKG_BUFSIZE]; static char filebuf[PKG_BUFSIZE];
pkg_t *pkg; pkgconf_pkg_t *pkg;
FILE *f; FILE *f;
struct stat st; struct stat st;
@ -384,11 +364,11 @@ pkg_scan_dir(const char *path, pkg_iteration_func_t func)
if (f == NULL) if (f == NULL)
continue; continue;
pkg = pkg_new_from_file(filebuf, f, 0); pkg = pkgconf_pkg_new_from_file(filebuf, f, 0);
if (pkg != NULL) if (pkg != NULL)
{ {
func(pkg); func(pkg);
pkg_unref(pkg); pkgconf_pkg_unref(pkg);
} }
} }
@ -396,25 +376,25 @@ pkg_scan_dir(const char *path, pkg_iteration_func_t func)
} }
void void
pkgconf_scan_all(pkg_iteration_func_t func) pkgconf_scan_all(pkgconf_pkg_iteration_func_t func)
{ {
pkgconf_node_t *n; pkgconf_node_t *n;
pkg_dir_list_build(0); pkgconf_pkg_dir_list_build(0);
PKGCONF_FOREACH_LIST_ENTRY(pkg_dir_list.head, n) PKGCONF_FOREACH_LIST_ENTRY(pkg_dir_list.head, n)
{ {
pkg_path_t *pkg_path = n->data; pkg_path_t *pkg_path = n->data;
pkg_scan_dir(pkg_path->path, func); pkgconf_pkg_scan_dir(pkg_path->path, func);
} }
} }
#ifdef _WIN32 #ifdef _WIN32
pkg_t * pkgconf_pkg_t *
pkg_find_in_registry_key(HKEY hkey, const char *name, unsigned int flags) pkgconf_pkg_find_in_registry_key(HKEY hkey, const char *name, unsigned int flags)
{ {
pkg_t *pkg = NULL; pkgconf_pkg_t *pkg = NULL;
HKEY key; HKEY key;
int i = 0; int i = 0;
@ -435,7 +415,7 @@ pkg_find_in_registry_key(HKEY hkey, const char *name, unsigned int flags)
if (RegQueryValueEx(key, buf, NULL, &type, (LPBYTE) pathbuf, &pathbuflen) if (RegQueryValueEx(key, buf, NULL, &type, (LPBYTE) pathbuf, &pathbuflen)
== ERROR_SUCCESS && type == REG_SZ) == ERROR_SUCCESS && type == REG_SZ)
{ {
pkg = pkg_try_specific_path(pathbuf, name, flags); pkg = pkgconf_pkg_try_specific_path(pathbuf, name, flags);
if (pkg != NULL) if (pkg != NULL)
break; break;
} }
@ -448,23 +428,23 @@ pkg_find_in_registry_key(HKEY hkey, const char *name, unsigned int flags)
} }
#endif #endif
pkg_t * pkgconf_pkg_t *
pkg_find(const char *name, unsigned int flags) pkgconf_pkg_find(const char *name, unsigned int flags)
{ {
pkg_t *pkg = NULL; pkgconf_pkg_t *pkg = NULL;
pkgconf_node_t *n; pkgconf_node_t *n;
FILE *f; FILE *f;
pkg_dir_list_build(flags); pkgconf_pkg_dir_list_build(flags);
/* name might actually be a filename. */ /* name might actually be a filename. */
if (str_has_suffix(name, PKG_CONFIG_EXT)) if (str_has_suffix(name, PKG_CONFIG_EXT))
{ {
if ((f = fopen(name, "r")) != NULL) if ((f = fopen(name, "r")) != NULL)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
pkg = pkg_new_from_file(name, f, flags); pkg = pkgconf_pkg_new_from_file(name, f, flags);
path_add(pkg_get_parent_dir(pkg), &pkg_dir_list); path_add(pkg_get_parent_dir(pkg), &pkg_dir_list);
return pkg; return pkg;
@ -485,16 +465,16 @@ pkg_find(const char *name, unsigned int flags)
{ {
pkg_path_t *pkg_path = n->data; pkg_path_t *pkg_path = n->data;
pkg = pkg_try_specific_path(pkg_path->path, name, flags); pkg = pkgconf_pkg_try_specific_path(pkg_path->path, name, flags);
if (pkg != NULL) if (pkg != NULL)
goto out; goto out;
} }
#ifdef _WIN32 #ifdef _WIN32
/* support getting PKG_CONFIG_PATH from registry */ /* support getting PKG_CONFIG_PATH from registry */
pkg = pkg_find_in_registry_key(HKEY_CURRENT_USER, name, flags); pkg = pkgconf_pkg_find_in_registry_key(HKEY_CURRENT_USER, name, flags);
if (!pkg) if (!pkg)
pkg = pkg_find_in_registry_key(HKEY_LOCAL_MACHINE, name, flags); pkg = pkgconf_pkg_find_in_registry_key(HKEY_LOCAL_MACHINE, name, flags);
#endif #endif
out: out:
@ -625,7 +605,7 @@ pkgconf_compare_version(const char *a, const char *b)
return 1; return 1;
} }
static pkg_t pkg_config_virtual = { static pkgconf_pkg_t pkg_config_virtual = {
.id = "pkg-config", .id = "pkg-config",
.realname = "pkg-config", .realname = "pkg-config",
.description = "virtual package defining pkg-config API version supported", .description = "virtual package defining pkg-config API version supported",
@ -645,7 +625,7 @@ static pkg_t pkg_config_virtual = {
}, },
}; };
typedef bool (*pkgconf_vercmp_res_func_t)(pkg_t *pkg, pkgconf_dependency_t *pkgdep); typedef bool (*pkgconf_vercmp_res_func_t)(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep);
typedef struct { typedef struct {
const char *name; const char *name;
@ -663,37 +643,37 @@ static pkgconf_pkg_comparator_name_t pkgconf_pkg_comparator_names[PKG_CMP_SIZE +
{"???", PKG_CMP_SIZE}, {"???", PKG_CMP_SIZE},
}; };
static bool pkgconf_pkg_comparator_lt(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_lt(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
return (pkgconf_compare_version(pkg->version, pkgdep->version) < 0); return (pkgconf_compare_version(pkg->version, pkgdep->version) < 0);
} }
static bool pkgconf_pkg_comparator_gt(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_gt(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
return (pkgconf_compare_version(pkg->version, pkgdep->version) > 0); return (pkgconf_compare_version(pkg->version, pkgdep->version) > 0);
} }
static bool pkgconf_pkg_comparator_lte(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_lte(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
return (pkgconf_compare_version(pkg->version, pkgdep->version) <= 0); return (pkgconf_compare_version(pkg->version, pkgdep->version) <= 0);
} }
static bool pkgconf_pkg_comparator_gte(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_gte(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
return (pkgconf_compare_version(pkg->version, pkgdep->version) >= 0); return (pkgconf_compare_version(pkg->version, pkgdep->version) >= 0);
} }
static bool pkgconf_pkg_comparator_eq(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_eq(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
return (pkgconf_compare_version(pkg->version, pkgdep->version) == 0); return (pkgconf_compare_version(pkg->version, pkgdep->version) == 0);
} }
static bool pkgconf_pkg_comparator_ne(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_ne(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
return (pkgconf_compare_version(pkg->version, pkgdep->version) != 0); return (pkgconf_compare_version(pkg->version, pkgdep->version) != 0);
} }
static bool pkgconf_pkg_comparator_any(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_any(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
(void) pkg; (void) pkg;
(void) pkgdep; (void) pkgdep;
@ -701,7 +681,7 @@ static bool pkgconf_pkg_comparator_any(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
return true; return true;
} }
static bool pkgconf_pkg_comparator_unimplemented(pkg_t *pkg, pkgconf_dependency_t *pkgdep) static bool pkgconf_pkg_comparator_unimplemented(pkgconf_pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{ {
(void) pkg; (void) pkg;
(void) pkgdep; (void) pkgdep;
@ -766,12 +746,12 @@ pkgconf_pkg_comparator_lookup_by_name(const char *name)
* pkg_verify_dependency(pkgdep, flags) * pkg_verify_dependency(pkgdep, flags)
* *
* verify a pkgconf_dependency_t node in the depgraph. if the dependency is solvable, * verify a pkgconf_dependency_t node in the depgraph. if the dependency is solvable,
* return the appropriate pkg_t object, else NULL. * return the appropriate pkgconf_pkg_t object, else NULL.
*/ */
pkg_t * pkgconf_pkg_t *
pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags) pkgconf_pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags)
{ {
pkg_t *pkg = &pkg_config_virtual; pkgconf_pkg_t *pkg = &pkg_config_virtual;
if (eflags != NULL) if (eflags != NULL)
*eflags = PKG_ERRF_OK; *eflags = PKG_ERRF_OK;
@ -779,7 +759,7 @@ pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned
/* pkg-config package name is special cased. */ /* pkg-config package name is special cased. */
if (strcasecmp(pkgdep->package, "pkg-config")) if (strcasecmp(pkgdep->package, "pkg-config"))
{ {
pkg = pkg_find(pkgdep->package, flags); pkg = pkgconf_pkg_find(pkgdep->package, flags);
if (pkg == NULL) if (pkg == NULL)
{ {
if (eflags != NULL) if (eflags != NULL)
@ -805,16 +785,16 @@ pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned
* pkg_verify_graph(root, depth) * pkg_verify_graph(root, depth)
* *
* verify the graph dependency nodes are satisfiable by walking the tree using * verify the graph dependency nodes are satisfiable by walking the tree using
* pkg_traverse(). * pkgconf_pkg_traverse().
*/ */
unsigned int unsigned int
pkg_verify_graph(pkg_t *root, int depth, unsigned int flags) pkgconf_pkg_verify_graph(pkgconf_pkg_t *root, int depth, unsigned int flags)
{ {
return pkg_traverse(root, NULL, NULL, depth, flags); return pkgconf_pkg_traverse(root, NULL, NULL, depth, flags);
} }
static unsigned int static unsigned int
pkg_report_graph_error(pkg_t *parent, pkg_t *pkg, pkgconf_dependency_t *node, unsigned int eflags) pkgconf_pkg_report_graph_error(pkgconf_pkg_t *parent, pkgconf_pkg_t *pkg, pkgconf_dependency_t *node, unsigned int eflags)
{ {
static bool already_sent_notice = false; static bool already_sent_notice = false;
@ -841,15 +821,15 @@ pkg_report_graph_error(pkg_t *parent, pkg_t *pkg, pkgconf_dependency_t *node, un
} }
if (pkg != NULL) if (pkg != NULL)
pkg_unref(pkg); pkgconf_pkg_unref(pkg);
return eflags; return eflags;
} }
static inline unsigned int static inline unsigned int
pkg_walk_list(pkg_t *parent, pkgconf_pkg_walk_list(pkgconf_pkg_t *parent,
pkgconf_list_t *deplist, pkgconf_list_t *deplist,
pkg_traverse_func_t func, pkgconf_pkg_traverse_func_t func,
void *data, void *data,
int depth, int depth,
unsigned int flags) unsigned int flags)
@ -861,17 +841,17 @@ pkg_walk_list(pkg_t *parent,
{ {
unsigned int eflags_local = PKG_ERRF_OK; unsigned int eflags_local = PKG_ERRF_OK;
pkgconf_dependency_t *depnode = node->data; pkgconf_dependency_t *depnode = node->data;
pkg_t *pkgdep; pkgconf_pkg_t *pkgdep;
if (*depnode->package == '\0') if (*depnode->package == '\0')
continue; continue;
pkgdep = pkg_verify_dependency(depnode, flags, &eflags_local); pkgdep = pkgconf_pkg_verify_dependency(depnode, flags, &eflags_local);
eflags |= eflags_local; eflags |= eflags_local;
if (eflags_local != PKG_ERRF_OK && !(flags & PKGF_SKIP_ERRORS)) if (eflags_local != PKG_ERRF_OK && !(flags & PKGF_SKIP_ERRORS))
{ {
pkg_report_graph_error(parent, pkgdep, depnode, eflags_local); pkgconf_pkg_report_graph_error(parent, pkgdep, depnode, eflags_local);
continue; continue;
} }
if (pkgdep == NULL) if (pkgdep == NULL)
@ -879,21 +859,21 @@ pkg_walk_list(pkg_t *parent,
if (pkgdep->flags & PKG_PROPF_SEEN) if (pkgdep->flags & PKG_PROPF_SEEN)
{ {
pkg_unref(pkgdep); pkgconf_pkg_unref(pkgdep);
continue; continue;
} }
pkgdep->flags |= PKG_PROPF_SEEN; pkgdep->flags |= PKG_PROPF_SEEN;
eflags |= pkg_traverse(pkgdep, func, data, depth - 1, flags); eflags |= pkgconf_pkg_traverse(pkgdep, func, data, depth - 1, flags);
pkgdep->flags &= ~PKG_PROPF_SEEN; pkgdep->flags &= ~PKG_PROPF_SEEN;
pkg_unref(pkgdep); pkgconf_pkg_unref(pkgdep);
} }
return eflags; return eflags;
} }
static inline unsigned int static inline unsigned int
pkg_walk_conflicts_list(pkg_t *root, pkgconf_list_t *deplist, unsigned int flags) pkgconf_pkg_walk_conflicts_list(pkgconf_pkg_t *root, pkgconf_list_t *deplist, unsigned int flags)
{ {
unsigned int eflags; unsigned int eflags;
pkgconf_node_t *node, *childnode; pkgconf_node_t *node, *childnode;
@ -907,13 +887,13 @@ pkg_walk_conflicts_list(pkg_t *root, pkgconf_list_t *deplist, unsigned int flags
PKGCONF_FOREACH_LIST_ENTRY(root->requires.head, childnode) PKGCONF_FOREACH_LIST_ENTRY(root->requires.head, childnode)
{ {
pkg_t *pkgdep; pkgconf_pkg_t *pkgdep;
pkgconf_dependency_t *depnode = childnode->data; pkgconf_dependency_t *depnode = childnode->data;
if (*depnode->package == '\0' || strcmp(depnode->package, parentnode->package)) if (*depnode->package == '\0' || strcmp(depnode->package, parentnode->package))
continue; continue;
pkgdep = pkg_verify_dependency(parentnode, flags, &eflags); pkgdep = pkgconf_pkg_verify_dependency(parentnode, flags, &eflags);
if (eflags == PKG_ERRF_OK) if (eflags == PKG_ERRF_OK)
{ {
fprintf(error_msgout, "Version '%s' of '%s' conflicts with '%s' due to satisfying conflict rule '%s %s%s%s'.\n", fprintf(error_msgout, "Version '%s' of '%s' conflicts with '%s' due to satisfying conflict rule '%s %s%s%s'.\n",
@ -922,12 +902,12 @@ pkg_walk_conflicts_list(pkg_t *root, pkgconf_list_t *deplist, unsigned int flags
fprintf(error_msgout, "It may be possible to ignore this conflict and continue, try the\n"); fprintf(error_msgout, "It may be possible to ignore this conflict and continue, try the\n");
fprintf(error_msgout, "PKG_CONFIG_IGNORE_CONFLICTS environment variable.\n"); fprintf(error_msgout, "PKG_CONFIG_IGNORE_CONFLICTS environment variable.\n");
pkg_unref(pkgdep); pkgconf_pkg_unref(pkgdep);
return PKG_ERRF_PACKAGE_CONFLICT; return PKG_ERRF_PACKAGE_CONFLICT;
} }
pkg_unref(pkgdep); pkgconf_pkg_unref(pkgdep);
} }
} }
@ -935,13 +915,13 @@ pkg_walk_conflicts_list(pkg_t *root, pkgconf_list_t *deplist, unsigned int flags
} }
/* /*
* pkg_traverse(root, func, data, maxdepth, flags) * pkgconf_pkg_traverse(root, func, data, maxdepth, flags)
* *
* walk the dependency graph up to maxdepth levels. -1 means infinite recursion. * walk the dependency graph up to maxdepth levels. -1 means infinite recursion.
*/ */
unsigned int unsigned int
pkg_traverse(pkg_t *root, pkgconf_pkg_traverse(pkgconf_pkg_t *root,
pkg_traverse_func_t func, pkgconf_pkg_traverse_func_t func,
void *data, void *data,
int maxdepth, int maxdepth,
unsigned int flags) unsigned int flags)
@ -960,18 +940,18 @@ pkg_traverse(pkg_t *root,
if (!(flags & PKGF_SKIP_CONFLICTS)) if (!(flags & PKGF_SKIP_CONFLICTS))
{ {
eflags = pkg_walk_conflicts_list(root, &root->conflicts, rflags); eflags = pkgconf_pkg_walk_conflicts_list(root, &root->conflicts, rflags);
if (eflags != PKG_ERRF_OK) if (eflags != PKG_ERRF_OK)
return eflags; return eflags;
} }
eflags = pkg_walk_list(root, &root->requires, func, data, maxdepth, rflags); eflags = pkgconf_pkg_walk_list(root, &root->requires, func, data, maxdepth, rflags);
if (eflags != PKG_ERRF_OK) if (eflags != PKG_ERRF_OK)
return eflags; return eflags;
if (flags & PKGF_SEARCH_PRIVATE) if (flags & PKGF_SEARCH_PRIVATE)
{ {
eflags = pkg_walk_list(root, &root->requires_private, func, data, maxdepth, rflags | PKGF_ITER_PKG_IS_PRIVATE); eflags = pkgconf_pkg_walk_list(root, &root->requires_private, func, data, maxdepth, rflags | PKGF_ITER_PKG_IS_PRIVATE);
if (eflags != PKG_ERRF_OK) if (eflags != PKG_ERRF_OK)
return eflags; return eflags;
} }
@ -980,7 +960,7 @@ pkg_traverse(pkg_t *root,
} }
static void static void
pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags) pkgconf_pkg_cflags_collect(pkgconf_pkg_t *pkg, void *data, unsigned int flags)
{ {
pkgconf_list_t *list = data; pkgconf_list_t *list = data;
pkgconf_node_t *node; pkgconf_node_t *node;
@ -994,7 +974,7 @@ pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags)
} }
static void static void
pkg_cflags_private_collect(pkg_t *pkg, void *data, unsigned int flags) pkgconf_pkg_cflags_private_collect(pkgconf_pkg_t *pkg, void *data, unsigned int flags)
{ {
pkgconf_list_t *list = data; pkgconf_list_t *list = data;
pkgconf_node_t *node; pkgconf_node_t *node;
@ -1009,17 +989,17 @@ pkg_cflags_private_collect(pkg_t *pkg, void *data, unsigned int flags)
} }
int int
pkg_cflags(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags) pkgconf_pkg_cflags(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
eflag = pkg_traverse(root, pkg_cflags_collect, list, maxdepth, flags); eflag = pkgconf_pkg_traverse(root, pkgconf_pkg_cflags_collect, list, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
pkgconf_fragment_free(list); pkgconf_fragment_free(list);
if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS) if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS)
{ {
eflag = pkg_traverse(root, pkg_cflags_private_collect, list, maxdepth, flags); eflag = pkgconf_pkg_traverse(root, pkgconf_pkg_cflags_private_collect, list, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
pkgconf_fragment_free(list); pkgconf_fragment_free(list);
} }
@ -1028,7 +1008,7 @@ pkg_cflags(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags)
} }
static void static void
pkg_libs_collect(pkg_t *pkg, void *data, unsigned int flags) pkgconf_pkg_libs_collect(pkgconf_pkg_t *pkg, void *data, unsigned int flags)
{ {
pkgconf_list_t *list = data; pkgconf_list_t *list = data;
pkgconf_node_t *node; pkgconf_node_t *node;
@ -1051,11 +1031,11 @@ pkg_libs_collect(pkg_t *pkg, void *data, unsigned int flags)
} }
int int
pkg_libs(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags) pkgconf_pkg_libs(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
eflag = pkg_traverse(root, pkg_libs_collect, list, maxdepth, flags); eflag = pkgconf_pkg_traverse(root, pkgconf_pkg_libs_collect, list, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
{ {

View File

@ -30,7 +30,7 @@ pkgconf_queue_push(pkgconf_list_t *list, const char *package)
} }
bool bool
pkgconf_queue_compile(pkg_t *world, pkgconf_list_t *list) pkgconf_queue_compile(pkgconf_pkg_t *world, pkgconf_list_t *list)
{ {
pkgconf_node_t *iter; pkgconf_node_t *iter;
@ -60,18 +60,18 @@ pkgconf_queue_free(pkgconf_list_t *list)
} }
static inline unsigned int static inline unsigned int
pkgconf_queue_verify(pkg_t *world, pkgconf_list_t *list, int maxdepth, unsigned int flags) pkgconf_queue_verify(pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth, unsigned int flags)
{ {
if (!pkgconf_queue_compile(world, list)) if (!pkgconf_queue_compile(world, list))
return PKG_ERRF_DEPGRAPH_BREAK; return PKG_ERRF_DEPGRAPH_BREAK;
return pkg_verify_graph(world, maxdepth, flags); return pkgconf_pkg_verify_graph(world, maxdepth, flags);
} }
bool bool
pkgconf_queue_apply(pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) pkgconf_queue_apply(pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data)
{ {
pkg_t world = { pkgconf_pkg_t world = {
.id = "world", .id = "world",
.realname = "virtual world package", .realname = "virtual world package",
.flags = PKG_PROPF_VIRTUAL, .flags = PKG_PROPF_VIRTUAL,
@ -86,11 +86,11 @@ pkgconf_queue_apply(pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int m
if (!func(&world, data, maxdepth, flags)) if (!func(&world, data, maxdepth, flags))
{ {
pkg_free(&world); pkgconf_pkg_free(&world);
return false; return false;
} }
pkg_free(&world); pkgconf_pkg_free(&world);
return true; return true;
} }
@ -99,7 +99,7 @@ bool
pkgconf_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags) pkgconf_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags)
{ {
bool retval = true; bool retval = true;
pkg_t world = { pkgconf_pkg_t world = {
.id = "world", .id = "world",
.realname = "virtual world package", .realname = "virtual world package",
.flags = PKG_PROPF_VIRTUAL, .flags = PKG_PROPF_VIRTUAL,
@ -112,7 +112,7 @@ pkgconf_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags)
if (pkgconf_queue_verify(&world, list, maxdepth, flags) != PKG_ERRF_OK) if (pkgconf_queue_verify(&world, list, maxdepth, flags) != PKG_ERRF_OK)
retval = false; retval = false;
pkg_free(&world); pkgconf_pkg_free(&world);
return retval; return retval;
} }

80
main.c
View File

@ -107,7 +107,7 @@ print_fragment(pkgconf_fragment_t *frag)
} }
static void static void
print_list_entry(const pkg_t *entry) print_list_entry(const pkgconf_pkg_t *entry)
{ {
if (entry->flags & PKG_PROPF_UNINSTALLED) if (entry->flags & PKG_PROPF_UNINSTALLED)
return; return;
@ -116,7 +116,7 @@ print_list_entry(const pkg_t *entry)
} }
static void static void
print_package_entry(const pkg_t *entry) print_package_entry(const pkgconf_pkg_t *entry)
{ {
if (entry->flags & PKG_PROPF_UNINSTALLED) if (entry->flags & PKG_PROPF_UNINSTALLED)
return; return;
@ -171,7 +171,7 @@ print_libs(pkgconf_list_t *list)
} }
static void static void
print_modversion(pkg_t *pkg, void *unused, unsigned int flags) print_modversion(pkgconf_pkg_t *pkg, void *unused, unsigned int flags)
{ {
(void) unused; (void) unused;
(void) flags; (void) flags;
@ -181,7 +181,7 @@ print_modversion(pkg_t *pkg, void *unused, unsigned int flags)
} }
static void static void
print_variables(pkg_t *pkg, void *unused, unsigned int flags) print_variables(pkgconf_pkg_t *pkg, void *unused, unsigned int flags)
{ {
pkgconf_node_t *node; pkgconf_node_t *node;
(void) unused; (void) unused;
@ -196,7 +196,7 @@ print_variables(pkg_t *pkg, void *unused, unsigned int flags)
} }
static void static void
print_requires(pkg_t *pkg) print_requires(pkgconf_pkg_t *pkg)
{ {
pkgconf_node_t *node; pkgconf_node_t *node;
@ -214,7 +214,7 @@ print_requires(pkg_t *pkg)
} }
static void static void
print_requires_private(pkg_t *pkg) print_requires_private(pkgconf_pkg_t *pkg)
{ {
pkgconf_node_t *node; pkgconf_node_t *node;
@ -232,7 +232,7 @@ print_requires_private(pkg_t *pkg)
} }
static void static void
print_digraph_node(pkg_t *pkg, void *unused, unsigned int flags) print_digraph_node(pkgconf_pkg_t *pkg, void *unused, unsigned int flags)
{ {
pkgconf_node_t *node; pkgconf_node_t *node;
(void) unused; (void) unused;
@ -249,7 +249,7 @@ print_digraph_node(pkg_t *pkg, void *unused, unsigned int flags)
} }
static bool static bool
apply_digraph(pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_digraph(pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
@ -257,7 +257,7 @@ apply_digraph(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n"); printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
printf("node [fontname=Sans fontsize=8]\n"); printf("node [fontname=Sans fontsize=8]\n");
eflag = pkg_traverse(world, print_digraph_node, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(world, print_digraph_node, unused, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -267,11 +267,11 @@ apply_digraph(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
} }
static bool static bool
apply_modversion(pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_modversion(pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
eflag = pkg_traverse(world, print_modversion, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(world, print_modversion, unused, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -280,11 +280,11 @@ apply_modversion(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
} }
static bool static bool
apply_variables(pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_variables(pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
eflag = pkg_traverse(world, print_variables, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(world, print_variables, unused, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -298,7 +298,7 @@ typedef struct {
} var_request_t; } var_request_t;
static void static void
print_variable(pkg_t *pkg, void *data, unsigned int flags) print_variable(pkgconf_pkg_t *pkg, void *data, unsigned int flags)
{ {
var_request_t *req = data; var_request_t *req = data;
const char *var; const char *var;
@ -330,7 +330,7 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags)
} }
static bool static bool
apply_variable(pkg_t *world, void *variable, int maxdepth, unsigned int flags) apply_variable(pkgconf_pkg_t *world, void *variable, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
@ -340,7 +340,7 @@ apply_variable(pkg_t *world, void *variable, int maxdepth, unsigned int flags)
*req.buf = '\0'; *req.buf = '\0';
eflag = pkg_traverse(world, print_variable, &req, maxdepth, flags); eflag = pkgconf_pkg_traverse(world, print_variable, &req, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -349,12 +349,12 @@ apply_variable(pkg_t *world, void *variable, int maxdepth, unsigned int flags)
} }
static bool static bool
apply_cflags(pkg_t *world, void *list_head, int maxdepth, unsigned int flags) apply_cflags(pkgconf_pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
{ {
pkgconf_list_t *list = list_head; pkgconf_list_t *list = list_head;
int eflag; int eflag;
eflag = pkg_cflags(world, list, maxdepth, flags | PKGF_SEARCH_PRIVATE); eflag = pkgconf_pkg_cflags(world, list, maxdepth, flags | PKGF_SEARCH_PRIVATE);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -369,12 +369,12 @@ apply_cflags(pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
} }
static bool static bool
apply_libs(pkg_t *world, void *list_head, int maxdepth, unsigned int flags) apply_libs(pkgconf_pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
{ {
pkgconf_list_t *list = list_head; pkgconf_list_t *list = list_head;
int eflag; int eflag;
eflag = pkg_libs(world, list, maxdepth, flags); eflag = pkgconf_pkg_libs(world, list, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -389,7 +389,7 @@ apply_libs(pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
} }
static bool static bool
apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_requires(pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags)
{ {
pkgconf_node_t *iter; pkgconf_node_t *iter;
(void) unused; (void) unused;
@ -397,20 +397,20 @@ apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
PKGCONF_FOREACH_LIST_ENTRY(world->requires.head, iter) PKGCONF_FOREACH_LIST_ENTRY(world->requires.head, iter)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_dependency_t *dep = iter->data; pkgconf_dependency_t *dep = iter->data;
pkg = pkg_verify_dependency(dep, flags, NULL); pkg = pkgconf_pkg_verify_dependency(dep, flags, NULL);
print_requires(pkg); print_requires(pkg);
pkg_free(pkg); pkgconf_pkg_free(pkg);
} }
return true; return true;
} }
static bool static bool
apply_requires_private(pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_requires_private(pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags)
{ {
pkgconf_node_t *iter; pkgconf_node_t *iter;
(void) unused; (void) unused;
@ -418,19 +418,19 @@ apply_requires_private(pkg_t *world, void *unused, int maxdepth, unsigned int fl
PKGCONF_FOREACH_LIST_ENTRY(world->requires.head, iter) PKGCONF_FOREACH_LIST_ENTRY(world->requires.head, iter)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_dependency_t *dep = iter->data; pkgconf_dependency_t *dep = iter->data;
pkg = pkg_verify_dependency(dep, flags | PKGF_SEARCH_PRIVATE, NULL); pkg = pkgconf_pkg_verify_dependency(dep, flags | PKGF_SEARCH_PRIVATE, NULL);
print_requires_private(pkg); print_requires_private(pkg);
pkg_free(pkg); pkgconf_pkg_free(pkg);
} }
return true; return true;
} }
static void static void
check_uninstalled(pkg_t *pkg, void *data, unsigned int flags) check_uninstalled(pkgconf_pkg_t *pkg, void *data, unsigned int flags)
{ {
int *retval = data; int *retval = data;
(void) flags; (void) flags;
@ -440,11 +440,11 @@ check_uninstalled(pkg_t *pkg, void *data, unsigned int flags)
} }
static bool static bool
apply_uninstalled(pkg_t *world, void *data, int maxdepth, unsigned int flags) apply_uninstalled(pkgconf_pkg_t *world, void *data, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
eflag = pkg_traverse(world, check_uninstalled, data, maxdepth, flags); eflag = pkgconf_pkg_traverse(world, check_uninstalled, data, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -453,7 +453,7 @@ apply_uninstalled(pkg_t *world, void *data, int maxdepth, unsigned int flags)
} }
static void static void
print_graph_node(pkg_t *pkg, void *data, unsigned int flags) print_graph_node(pkgconf_pkg_t *pkg, void *data, unsigned int flags)
{ {
pkgconf_node_t *n; pkgconf_node_t *n;
@ -484,11 +484,11 @@ print_graph_node(pkg_t *pkg, void *data, unsigned int flags)
} }
static bool static bool
apply_simulate(pkg_t *world, void *data, int maxdepth, unsigned int flags) apply_simulate(pkgconf_pkg_t *world, void *data, int maxdepth, unsigned int flags)
{ {
int eflag; int eflag;
eflag = pkg_traverse(world, print_graph_node, data, maxdepth, flags); eflag = pkgconf_pkg_traverse(world, print_graph_node, data, maxdepth, flags);
if (eflag != PKG_ERRF_OK) if (eflag != PKG_ERRF_OK)
return false; return false;
@ -753,7 +753,7 @@ main(int argc, char *argv[])
if (required_module_version != NULL) if (required_module_version != NULL)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_node_t *node; pkgconf_node_t *node;
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
@ -767,7 +767,7 @@ main(int argc, char *argv[])
{ {
pkgconf_dependency_t *pkgiter = node->data; pkgconf_dependency_t *pkgiter = node->data;
pkg = pkg_find(pkgiter->package, global_traverse_flags); pkg = pkgconf_pkg_find(pkgiter->package, global_traverse_flags);
if (pkg == NULL) if (pkg == NULL)
return EXIT_FAILURE; return EXIT_FAILURE;
@ -780,7 +780,7 @@ main(int argc, char *argv[])
if (required_exact_module_version != NULL) if (required_exact_module_version != NULL)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_node_t *node; pkgconf_node_t *node;
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
@ -794,7 +794,7 @@ main(int argc, char *argv[])
{ {
pkgconf_dependency_t *pkgiter = node->data; pkgconf_dependency_t *pkgiter = node->data;
pkg = pkg_find(pkgiter->package, global_traverse_flags); pkg = pkgconf_pkg_find(pkgiter->package, global_traverse_flags);
if (pkg == NULL) if (pkg == NULL)
return EXIT_FAILURE; return EXIT_FAILURE;
@ -807,7 +807,7 @@ main(int argc, char *argv[])
if (required_max_module_version != NULL) if (required_max_module_version != NULL)
{ {
pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_node_t *node; pkgconf_node_t *node;
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
@ -821,7 +821,7 @@ main(int argc, char *argv[])
{ {
pkgconf_dependency_t *pkgiter = node->data; pkgconf_dependency_t *pkgiter = node->data;
pkg = pkg_find(pkgiter->package, global_traverse_flags); pkg = pkgconf_pkg_find(pkgiter->package, global_traverse_flags);
if (pkg == NULL) if (pkg == NULL)
return EXIT_FAILURE; return EXIT_FAILURE;