diff --git a/libpkgconf/cache.c b/libpkgconf/cache.c index eb037e7..64246d5 100644 --- a/libpkgconf/cache.c +++ b/libpkgconf/cache.c @@ -15,7 +15,7 @@ #include -static pkg_list_t pkg_cache = PKG_LIST_INITIALIZER; +static pkgconf_list_t pkg_cache = PKGCONF_LIST_INITIALIZER; /* * pkg_cache_lookup(id) @@ -27,9 +27,9 @@ static pkg_list_t pkg_cache = PKG_LIST_INITIALIZER; pkg_t * pkg_cache_lookup(const char *id) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(pkg_cache.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg_cache.head, node) { pkg_t *pkg = node->data; @@ -54,7 +54,7 @@ pkg_cache_add(pkg_t *pkg) pkg_ref(pkg); - pkg_node_insert(&pkg->cache_iter, pkg, &pkg_cache); + pkgconf_node_insert(&pkg->cache_iter, pkg, &pkg_cache); } /* @@ -68,15 +68,15 @@ pkg_cache_remove(pkg_t *pkg) if (pkg == NULL) return; - pkg_node_delete(&pkg->cache_iter, &pkg_cache); + pkgconf_node_delete(&pkg->cache_iter, &pkg_cache); } void pkg_cache_free(void) { - pkg_node_t *iter, *iter2; + pkgconf_node_t *iter, *iter2; - PKG_FOREACH_LIST_ENTRY_SAFE(pkg_cache.head, iter2, iter) + PKGCONF_FOREACH_LIST_ENTRY_SAFE(pkg_cache.head, iter2, iter) { pkg_t *pkg = iter->data; diff --git a/libpkgconf/dependency.c b/libpkgconf/dependency.c index 755c073..f06771a 100644 --- a/libpkgconf/dependency.c +++ b/libpkgconf/dependency.c @@ -36,7 +36,7 @@ typedef enum { #define DEBUG_PARSE 0 static inline pkg_dependency_t * -pkg_dependency_add(pkg_list_t *list, const char *package, size_t package_sz, const char *version, size_t version_sz, pkg_comparator_t compare) +pkg_dependency_add(pkgconf_list_t *list, const char *package, size_t package_sz, const char *version, size_t version_sz, pkg_comparator_t compare) { pkg_dependency_t *dep; @@ -48,7 +48,7 @@ pkg_dependency_add(pkg_list_t *list, const char *package, size_t package_sz, con dep->compare = compare; - pkg_node_insert_tail(&dep->iter, dep, list); + pkgconf_node_insert_tail(&dep->iter, dep, list); #if DEBUG_PARSE fprintf(error_msgout, "--> %s %d %s\n", dep->package, dep->compare, dep->version); @@ -58,17 +58,17 @@ pkg_dependency_add(pkg_list_t *list, const char *package, size_t package_sz, con } void -pkg_dependency_append(pkg_list_t *list, pkg_dependency_t *tail) +pkg_dependency_append(pkgconf_list_t *list, pkg_dependency_t *tail) { - pkg_node_insert_tail(&tail->iter, tail, list); + pkgconf_node_insert_tail(&tail->iter, tail, list); } void -pkg_dependency_free(pkg_list_t *list) +pkg_dependency_free(pkgconf_list_t *list) { - pkg_node_t *node, *next; + pkgconf_node_t *node, *next; - PKG_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) + PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) { pkg_dependency_t *dep = node->data; @@ -83,7 +83,7 @@ pkg_dependency_free(pkg_list_t *list) } void -pkg_dependency_parse_str(pkg_list_t *deplist_head, const char *depends) +pkg_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) { parse_state_t state = OUTSIDE_MODULE; pkg_comparator_t compare = PKG_ANY; @@ -223,7 +223,7 @@ pkg_dependency_parse_str(pkg_list_t *deplist_head, const char *depends) } void -pkg_dependency_parse(pkg_t *pkg, pkg_list_t *deplist, const char *depends) +pkg_dependency_parse(pkg_t *pkg, pkgconf_list_t *deplist, const char *depends) { char *kvdepends = pkg_tuple_parse(&pkg->vars, depends); diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index 5e6bfd4..06173ed 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -37,7 +37,7 @@ pkg_fragment_copy_munged(const char *source, unsigned int flags) } void -pkg_fragment_add(pkg_list_t *list, const char *string, unsigned int flags) +pkg_fragment_add(pkgconf_list_t *list, const char *string, unsigned int flags) { pkg_fragment_t *frag; @@ -77,15 +77,15 @@ pkg_fragment_add(pkg_list_t *list, const char *string, unsigned int flags) frag->data = strdup(string); } - pkg_node_insert_tail(&frag->iter, frag, list); + pkgconf_node_insert_tail(&frag->iter, frag, list); } static inline pkg_fragment_t * -pkg_fragment_lookup(pkg_list_t *list, pkg_fragment_t *base) +pkg_fragment_lookup(pkgconf_list_t *list, pkg_fragment_t *base) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY_REVERSE(list->tail, node) + PKGCONF_FOREACH_LIST_ENTRY_REVERSE(list->tail, node) { pkg_fragment_t *frag = node->data; @@ -137,7 +137,7 @@ pkg_fragment_can_merge(pkg_fragment_t *base, unsigned int flags, bool is_private } static inline pkg_fragment_t * -pkg_fragment_exists(pkg_list_t *list, pkg_fragment_t *base, unsigned int flags, bool is_private) +pkg_fragment_exists(pkgconf_list_t *list, pkg_fragment_t *base, unsigned int flags, bool is_private) { if (!pkg_fragment_can_merge_back(base, flags, is_private)) return NULL; @@ -149,7 +149,7 @@ pkg_fragment_exists(pkg_list_t *list, pkg_fragment_t *base, unsigned int flags, } void -pkg_fragment_copy(pkg_list_t *list, pkg_fragment_t *base, unsigned int flags, bool is_private) +pkg_fragment_copy(pkgconf_list_t *list, pkg_fragment_t *base, unsigned int flags, bool is_private) { pkg_fragment_t *frag; @@ -163,24 +163,24 @@ pkg_fragment_copy(pkg_list_t *list, pkg_fragment_t *base, unsigned int flags, bo frag->type = base->type; frag->data = strdup(base->data); - pkg_node_insert_tail(&frag->iter, frag, list); + pkgconf_node_insert_tail(&frag->iter, frag, list); } void -pkg_fragment_delete(pkg_list_t *list, pkg_fragment_t *node) +pkg_fragment_delete(pkgconf_list_t *list, pkg_fragment_t *node) { - pkg_node_delete(&node->iter, list); + pkgconf_node_delete(&node->iter, list); free(node->data); free(node); } void -pkg_fragment_free(pkg_list_t *list) +pkg_fragment_free(pkgconf_list_t *list) { - pkg_node_t *node, *next; + pkgconf_node_t *node, *next; - PKG_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) + PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) { pkg_fragment_t *frag = node->data; @@ -190,7 +190,7 @@ pkg_fragment_free(pkg_list_t *list) } void -pkg_fragment_parse(pkg_list_t *list, pkg_list_t *vars, const char *value, unsigned int flags) +pkg_fragment_parse(pkgconf_list_t *list, pkgconf_list_t *vars, const char *value, unsigned int flags) { int i, argc; char **argv; diff --git a/libpkgconf/iter.h b/libpkgconf/iter.h index 54b42b9..fe0c287 100644 --- a/libpkgconf/iter.h +++ b/libpkgconf/iter.h @@ -16,23 +16,23 @@ #ifndef PKGCONF__ITER_H #define PKGCONF__ITER_H -typedef struct pkg_node_ pkg_node_t; +typedef struct pkgconf_node_ pkgconf_node_t; -struct pkg_node_ { - pkg_node_t *prev, *next; +struct pkgconf_node_ { + pkgconf_node_t *prev, *next; void *data; }; typedef struct { - pkg_node_t *head, *tail; -} pkg_list_t; + pkgconf_node_t *head, *tail; +} pkgconf_list_t; -#define PKG_LIST_INITIALIZER { NULL, NULL } +#define PKGCONF_LIST_INITIALIZER { NULL, NULL } static inline void -pkg_node_insert(pkg_node_t *node, void *data, pkg_list_t *list) +pkgconf_node_insert(pkgconf_node_t *node, void *data, pkgconf_list_t *list) { - pkg_node_t *tnode; + pkgconf_node_t *tnode; node->data = data; @@ -52,9 +52,9 @@ pkg_node_insert(pkg_node_t *node, void *data, pkg_list_t *list) } static inline void -pkg_node_insert_tail(pkg_node_t *node, void *data, pkg_list_t *list) +pkgconf_node_insert_tail(pkgconf_node_t *node, void *data, pkgconf_list_t *list) { - pkg_node_t *tnode; + pkgconf_node_t *tnode; node->data = data; @@ -74,7 +74,7 @@ pkg_node_insert_tail(pkg_node_t *node, void *data, pkg_list_t *list) } static inline void -pkg_node_delete(pkg_node_t *node, pkg_list_t *list) +pkgconf_node_delete(pkgconf_node_t *node, pkgconf_list_t *list) { if (node->prev == NULL) list->head = node->next; diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index 3a85328..ae570ba 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -40,27 +40,27 @@ typedef struct pkg_dependency_ pkg_dependency_t; typedef struct pkg_tuple_ pkg_tuple_t; typedef struct pkg_fragment_ pkg_fragment_t; -#define PKG_FOREACH_LIST_ENTRY(head, value) \ +#define PKGCONF_FOREACH_LIST_ENTRY(head, value) \ for ((value) = (head); (value) != NULL; (value) = (value)->next) -#define PKG_FOREACH_LIST_ENTRY_SAFE(head, nextiter, value) \ +#define PKGCONF_FOREACH_LIST_ENTRY_SAFE(head, nextiter, value) \ for ((value) = (head), (nextiter) = (head) != NULL ? (head)->next : NULL; (value) != NULL; (value) = (nextiter), (nextiter) = (nextiter) != NULL ? (nextiter)->next : NULL) -#define PKG_FOREACH_LIST_ENTRY_REVERSE(tail, value) \ +#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \ for ((value) = (tail); (value) != NULL; (value) = (value)->prev) #define PKG_MIN(a,b) (((a) < (b)) ? (a) : (b)) #define PKG_MAX(a,b) (((a) > (b)) ? (a) : (b)) struct pkg_fragment_ { - pkg_node_t iter; + pkgconf_node_t iter; char type; char *data; }; struct pkg_dependency_ { - pkg_node_t iter; + pkgconf_node_t iter; char *package; pkg_comparator_t compare; @@ -69,7 +69,7 @@ struct pkg_dependency_ { }; struct pkg_tuple_ { - pkg_node_t iter; + pkgconf_node_t iter; char *key; char *value; @@ -82,7 +82,7 @@ struct pkg_tuple_ { #define PKG_PROPF_UNINSTALLED 0x8 struct pkg_ { - pkg_node_t cache_iter; + pkgconf_node_t cache_iter; int refcount; char *id; @@ -93,16 +93,16 @@ struct pkg_ { char *url; char *pc_filedir; - pkg_list_t libs; - pkg_list_t libs_private; - pkg_list_t cflags; - pkg_list_t cflags_private; + pkgconf_list_t libs; + pkgconf_list_t libs_private; + pkgconf_list_t cflags; + pkgconf_list_t cflags_private; - pkg_list_t requires; - pkg_list_t requires_private; - pkg_list_t conflicts; + pkgconf_list_t requires; + pkgconf_list_t requires_private; + pkgconf_list_t conflicts; - pkg_list_t vars; + pkgconf_list_t vars; unsigned int flags; }; @@ -143,36 +143,36 @@ unsigned int pkg_verify_graph(pkg_t *root, int depth, unsigned int flags); int pkg_compare_version(const char *a, const char *b); pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags); const char *pkg_get_comparator(pkg_dependency_t *pkgdep); -int pkg_cflags(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags); -int pkg_libs(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags); +int pkg_cflags(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); pkg_comparator_t pkg_comparator_lookup_by_name(const char *name); /* parse.c */ pkg_t *pkg_new_from_file(const char *path, FILE *f, unsigned int flags); -void pkg_dependency_parse_str(pkg_list_t *deplist_head, const char *depends); -void pkg_dependency_parse(pkg_t *pkg, pkg_list_t *deplist_head, const char *depends); -void pkg_dependency_append(pkg_list_t *list, pkg_dependency_t *tail); -void pkg_dependency_free(pkg_list_t *list); +void pkg_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends); +void pkg_dependency_parse(pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends); +void pkg_dependency_append(pkgconf_list_t *list, pkg_dependency_t *tail); +void pkg_dependency_free(pkgconf_list_t *list); /* argvsplit.c */ int pkg_argv_split(const char *src, int *argc, char ***argv); void pkg_argv_free(char **argv); /* fragment.c */ -void pkg_fragment_parse(pkg_list_t *list, pkg_list_t *vars, const char *value, unsigned int flags); -void pkg_fragment_add(pkg_list_t *list, const char *string, unsigned int flags); -void pkg_fragment_copy(pkg_list_t *list, pkg_fragment_t *base, unsigned int flags, bool is_private); -void pkg_fragment_delete(pkg_list_t *list, pkg_fragment_t *node); -void pkg_fragment_free(pkg_list_t *list); +void pkg_fragment_parse(pkgconf_list_t *list, pkgconf_list_t *vars, const char *value, unsigned int flags); +void pkg_fragment_add(pkgconf_list_t *list, const char *string, unsigned int flags); +void pkg_fragment_copy(pkgconf_list_t *list, pkg_fragment_t *base, unsigned int flags, bool is_private); +void pkg_fragment_delete(pkgconf_list_t *list, pkg_fragment_t *node); +void pkg_fragment_free(pkgconf_list_t *list); /* fileio.c */ char *pkg_fgetline(char *line, size_t size, FILE *stream); /* tuple.c */ -pkg_tuple_t *pkg_tuple_add(pkg_list_t *parent, const char *key, const char *value); -char *pkg_tuple_find(pkg_list_t *list, const char *key); -char *pkg_tuple_parse(pkg_list_t *list, const char *value); -void pkg_tuple_free(pkg_list_t *list); +pkg_tuple_t *pkg_tuple_add(pkgconf_list_t *parent, const char *key, const char *value); +char *pkg_tuple_find(pkgconf_list_t *list, const char *key); +char *pkg_tuple_parse(pkgconf_list_t *list, const char *value); +void pkg_tuple_free(pkgconf_list_t *list); void pkg_tuple_add_global(const char *key, const char *value); char *pkg_tuple_find_global(const char *key); void pkg_tuple_free_global(void); @@ -182,11 +182,11 @@ void pkg_tuple_define_global(const char *kv); extern FILE *error_msgout; /* queue.c */ -void pkg_queue_push(pkg_list_t *list, const char *package); -bool pkg_queue_compile(pkg_t *world, pkg_list_t *list); -void pkg_queue_free(pkg_list_t *list); -bool pkg_queue_apply(pkg_list_t *list, pkg_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data); -bool pkg_queue_validate(pkg_list_t *list, int maxdepth, unsigned int flags); +void pkg_queue_push(pkgconf_list_t *list, const char *package); +bool pkg_queue_compile(pkg_t *world, pkgconf_list_t *list); +void pkg_queue_free(pkgconf_list_t *list); +bool pkg_queue_apply(pkgconf_list_t *list, pkg_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data); +bool pkg_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags); /* cache.c */ pkg_t *pkg_cache_lookup(const char *id); diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 0e4a5a1..9ebb855 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -39,22 +39,22 @@ typedef struct { char *path; - pkg_node_t node; + pkgconf_node_t node; } pkg_path_t; static inline void -path_add(const char *text, pkg_list_t *dirlist) +path_add(const char *text, pkgconf_list_t *dirlist) { pkg_path_t *pkg_path; pkg_path = calloc(sizeof(pkg_path_t), 1); pkg_path->path = strdup(text); - pkg_node_insert_tail(&pkg_path->node, pkg_path, dirlist); + pkgconf_node_insert_tail(&pkg_path->node, pkg_path, dirlist); } static inline size_t -path_split(const char *text, pkg_list_t *dirlist) +path_split(const char *text, pkgconf_list_t *dirlist) { size_t count = 0; char *workbuf, *p, *iter; @@ -75,11 +75,11 @@ path_split(const char *text, pkg_list_t *dirlist) } static inline void -path_free(pkg_list_t *dirlist) +path_free(pkgconf_list_t *dirlist) { - pkg_node_t *n, *tn; + pkgconf_node_t *n, *tn; - PKG_FOREACH_LIST_ENTRY_SAFE(dirlist->head, tn, n) + PKGCONF_FOREACH_LIST_ENTRY_SAFE(dirlist->head, tn, n) { pkg_path_t *pkg_path = n->data; @@ -157,7 +157,7 @@ pkg_get_parent_dir(pkg_t *pkg) return buf; } -static pkg_list_t pkg_dir_list = PKG_LIST_INITIALIZER; +static pkgconf_list_t pkg_dir_list = PKGCONF_LIST_INITIALIZER; void pkg_dir_list_build(unsigned int flags) @@ -398,11 +398,11 @@ pkg_scan_dir(const char *path, pkg_iteration_func_t func) void pkg_scan_all(pkg_iteration_func_t func) { - pkg_node_t *n; + pkgconf_node_t *n; pkg_dir_list_build(0); - PKG_FOREACH_LIST_ENTRY(pkg_dir_list.head, n) + PKGCONF_FOREACH_LIST_ENTRY(pkg_dir_list.head, n) { pkg_path_t *pkg_path = n->data; @@ -452,7 +452,7 @@ pkg_t * pkg_find(const char *name, unsigned int flags) { pkg_t *pkg = NULL; - pkg_node_t *n; + pkgconf_node_t *n; FILE *f; pkg_dir_list_build(flags); @@ -481,7 +481,7 @@ pkg_find(const char *name, unsigned int flags) } } - PKG_FOREACH_LIST_ENTRY(pkg_dir_list.head, n) + PKGCONF_FOREACH_LIST_ENTRY(pkg_dir_list.head, n) { pkg_path_t *pkg_path = n->data; @@ -633,7 +633,7 @@ static pkg_t pkg_config_virtual = { .version = PACKAGE_VERSION, .flags = PKG_PROPF_VIRTUAL, .vars = { - .head = &(pkg_node_t){ + .head = &(pkgconf_node_t){ .prev = NULL, .next = NULL, .data = &(pkg_tuple_t){ @@ -848,16 +848,16 @@ pkg_report_graph_error(pkg_t *parent, pkg_t *pkg, pkg_dependency_t *node, unsign static inline unsigned int pkg_walk_list(pkg_t *parent, - pkg_list_t *deplist, + pkgconf_list_t *deplist, pkg_traverse_func_t func, void *data, int depth, unsigned int flags) { unsigned int eflags = PKG_ERRF_OK; - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(deplist->head, node) + PKGCONF_FOREACH_LIST_ENTRY(deplist->head, node) { unsigned int eflags_local = PKG_ERRF_OK; pkg_dependency_t *depnode = node->data; @@ -893,19 +893,19 @@ pkg_walk_list(pkg_t *parent, } static inline unsigned int -pkg_walk_conflicts_list(pkg_t *root, pkg_list_t *deplist, unsigned int flags) +pkg_walk_conflicts_list(pkg_t *root, pkgconf_list_t *deplist, unsigned int flags) { unsigned int eflags; - pkg_node_t *node, *childnode; + pkgconf_node_t *node, *childnode; - PKG_FOREACH_LIST_ENTRY(deplist->head, node) + PKGCONF_FOREACH_LIST_ENTRY(deplist->head, node) { pkg_dependency_t *parentnode = node->data; if (*parentnode->package == '\0') continue; - PKG_FOREACH_LIST_ENTRY(root->requires.head, childnode) + PKGCONF_FOREACH_LIST_ENTRY(root->requires.head, childnode) { pkg_t *pkgdep; pkg_dependency_t *depnode = childnode->data; @@ -982,11 +982,11 @@ pkg_traverse(pkg_t *root, static void pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags) { - pkg_list_t *list = data; - pkg_node_t *node; + pkgconf_list_t *list = data; + pkgconf_node_t *node; (void) flags; - PKG_FOREACH_LIST_ENTRY(pkg->cflags.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->cflags.head, node) { pkg_fragment_t *frag = node->data; pkg_fragment_copy(list, frag, flags, false); @@ -996,11 +996,11 @@ pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags) static void pkg_cflags_private_collect(pkg_t *pkg, void *data, unsigned int flags) { - pkg_list_t *list = data; - pkg_node_t *node; + pkgconf_list_t *list = data; + pkgconf_node_t *node; (void) flags; - PKG_FOREACH_LIST_ENTRY(pkg->cflags_private.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->cflags_private.head, node) { pkg_fragment_t *frag = node->data; @@ -1009,7 +1009,7 @@ pkg_cflags_private_collect(pkg_t *pkg, void *data, unsigned int flags) } int -pkg_cflags(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags) +pkg_cflags(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags) { int eflag; @@ -1030,11 +1030,11 @@ pkg_cflags(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags) static void pkg_libs_collect(pkg_t *pkg, void *data, unsigned int flags) { - pkg_list_t *list = data; - pkg_node_t *node; + pkgconf_list_t *list = data; + pkgconf_node_t *node; (void) flags; - PKG_FOREACH_LIST_ENTRY(pkg->libs.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->libs.head, node) { pkg_fragment_t *frag = node->data; pkg_fragment_copy(list, frag, flags, (flags & PKGF_ITER_PKG_IS_PRIVATE) != 0); @@ -1042,7 +1042,7 @@ pkg_libs_collect(pkg_t *pkg, void *data, unsigned int flags) if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS) { - PKG_FOREACH_LIST_ENTRY(pkg->libs_private.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->libs_private.head, node) { pkg_fragment_t *frag = node->data; pkg_fragment_copy(list, frag, flags, true); @@ -1051,7 +1051,7 @@ pkg_libs_collect(pkg_t *pkg, void *data, unsigned int flags) } int -pkg_libs(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags) +pkg_libs(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags) { int eflag; diff --git a/libpkgconf/queue.c b/libpkgconf/queue.c index 03cfc3a..6fb5efd 100644 --- a/libpkgconf/queue.c +++ b/libpkgconf/queue.c @@ -16,25 +16,25 @@ #include typedef struct { - pkg_node_t iter; + pkgconf_node_t iter; char *package; } pkg_queue_t; void -pkg_queue_push(pkg_list_t *list, const char *package) +pkg_queue_push(pkgconf_list_t *list, const char *package) { pkg_queue_t *pkgq = calloc(sizeof(pkg_queue_t), 1); pkgq->package = strdup(package); - pkg_node_insert_tail(&pkgq->iter, pkgq, list); + pkgconf_node_insert_tail(&pkgq->iter, pkgq, list); } bool -pkg_queue_compile(pkg_t *world, pkg_list_t *list) +pkg_queue_compile(pkg_t *world, pkgconf_list_t *list) { - pkg_node_t *iter; + pkgconf_node_t *iter; - PKG_FOREACH_LIST_ENTRY(list->head, iter) + PKGCONF_FOREACH_LIST_ENTRY(list->head, iter) { pkg_queue_t *pkgq; @@ -46,11 +46,11 @@ pkg_queue_compile(pkg_t *world, pkg_list_t *list) } void -pkg_queue_free(pkg_list_t *list) +pkg_queue_free(pkgconf_list_t *list) { - pkg_node_t *node, *tnode; + pkgconf_node_t *node, *tnode; - PKG_FOREACH_LIST_ENTRY_SAFE(list->head, tnode, node) + PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, tnode, node) { pkg_queue_t *pkgq = node->data; @@ -60,7 +60,7 @@ pkg_queue_free(pkg_list_t *list) } static inline unsigned int -pkg_queue_verify(pkg_t *world, pkg_list_t *list, int maxdepth, unsigned int flags) +pkg_queue_verify(pkg_t *world, pkgconf_list_t *list, int maxdepth, unsigned int flags) { if (!pkg_queue_compile(world, list)) return PKG_ERRF_DEPGRAPH_BREAK; @@ -69,7 +69,7 @@ pkg_queue_verify(pkg_t *world, pkg_list_t *list, int maxdepth, unsigned int flag } bool -pkg_queue_apply(pkg_list_t *list, pkg_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) +pkg_queue_apply(pkgconf_list_t *list, pkg_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) { pkg_t world = { .id = "world", @@ -96,7 +96,7 @@ pkg_queue_apply(pkg_list_t *list, pkg_queue_apply_func_t func, int maxdepth, uns } bool -pkg_queue_validate(pkg_list_t *list, int maxdepth, unsigned int flags) +pkg_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags) { bool retval = true; pkg_t world = { diff --git a/libpkgconf/tuple.c b/libpkgconf/tuple.c index b177d4a..eb51427 100644 --- a/libpkgconf/tuple.c +++ b/libpkgconf/tuple.c @@ -15,7 +15,7 @@ #include -static pkg_list_t pkg_global_var = PKG_LIST_INITIALIZER; +static pkgconf_list_t pkg_global_var = PKGCONF_LIST_INITIALIZER; void pkg_tuple_add_global(const char *key, const char *value) @@ -26,9 +26,9 @@ pkg_tuple_add_global(const char *key, const char *value) char * pkg_tuple_find_global(const char *key) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(pkg_global_var.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg_global_var.head, node) { pkg_tuple_t *tuple = node->data; @@ -62,28 +62,28 @@ out: } pkg_tuple_t * -pkg_tuple_add(pkg_list_t *list, const char *key, const char *value) +pkg_tuple_add(pkgconf_list_t *list, const char *key, const char *value) { pkg_tuple_t *tuple = calloc(sizeof(pkg_tuple_t), 1); tuple->key = strdup(key); tuple->value = pkg_tuple_parse(list, value); - pkg_node_insert(&tuple->iter, tuple, list); + pkgconf_node_insert(&tuple->iter, tuple, list); return tuple; } char * -pkg_tuple_find(pkg_list_t *list, const char *key) +pkg_tuple_find(pkgconf_list_t *list, const char *key) { - pkg_node_t *node; + pkgconf_node_t *node; char *res; if ((res = pkg_tuple_find_global(key)) != NULL) return res; - PKG_FOREACH_LIST_ENTRY(list->head, node) + PKGCONF_FOREACH_LIST_ENTRY(list->head, node) { pkg_tuple_t *tuple = node->data; @@ -95,7 +95,7 @@ pkg_tuple_find(pkg_list_t *list, const char *key) } char * -pkg_tuple_parse(pkg_list_t *vars, const char *value) +pkg_tuple_parse(pkgconf_list_t *vars, const char *value) { char buf[PKG_BUFSIZE]; const char *ptr; @@ -146,11 +146,11 @@ pkg_tuple_parse(pkg_list_t *vars, const char *value) } void -pkg_tuple_free(pkg_list_t *list) +pkg_tuple_free(pkgconf_list_t *list) { - pkg_node_t *node, *next; + pkgconf_node_t *node, *next; - PKG_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) + PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) { pkg_tuple_t *tuple = node->data; diff --git a/main.c b/main.c index f040fec..41a9c70 100644 --- a/main.c +++ b/main.c @@ -125,11 +125,11 @@ print_package_entry(const pkg_t *entry) } static void -print_cflags(pkg_list_t *list) +print_cflags(pkgconf_list_t *list) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(list->head, node) + PKGCONF_FOREACH_LIST_ENTRY(list->head, node) { pkg_fragment_t *frag = node->data; int got_flags = 0; @@ -147,11 +147,11 @@ print_cflags(pkg_list_t *list) } static void -print_libs(pkg_list_t *list) +print_libs(pkgconf_list_t *list) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(list->head, node) + PKGCONF_FOREACH_LIST_ENTRY(list->head, node) { pkg_fragment_t *frag = node->data; int got_flags = 0; @@ -183,11 +183,11 @@ print_modversion(pkg_t *pkg, void *unused, unsigned int flags) static void print_variables(pkg_t *pkg, void *unused, unsigned int flags) { - pkg_node_t *node; + pkgconf_node_t *node; (void) unused; (void) flags; - PKG_FOREACH_LIST_ENTRY(pkg->vars.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->vars.head, node) { pkg_tuple_t *tuple = node->data; @@ -198,9 +198,9 @@ print_variables(pkg_t *pkg, void *unused, unsigned int flags) static void print_requires(pkg_t *pkg) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(pkg->requires.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->requires.head, node) { pkg_dependency_t *dep = node->data; @@ -216,9 +216,9 @@ print_requires(pkg_t *pkg) static void print_requires_private(pkg_t *pkg) { - pkg_node_t *node; + pkgconf_node_t *node; - PKG_FOREACH_LIST_ENTRY(pkg->requires_private.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node) { pkg_dependency_t *dep = node->data; @@ -234,13 +234,13 @@ print_requires_private(pkg_t *pkg) static void print_digraph_node(pkg_t *pkg, void *unused, unsigned int flags) { - pkg_node_t *node; + pkgconf_node_t *node; (void) unused; (void) flags; printf("\"%s\" [fontname=Sans fontsize=8]\n", pkg->id); - PKG_FOREACH_LIST_ENTRY(pkg->requires.head, node) + PKGCONF_FOREACH_LIST_ENTRY(pkg->requires.head, node) { pkg_dependency_t *dep = node->data; @@ -351,7 +351,7 @@ apply_variable(pkg_t *world, void *variable, int maxdepth, unsigned int flags) static bool apply_cflags(pkg_t *world, void *list_head, int maxdepth, unsigned int flags) { - pkg_list_t *list = list_head; + pkgconf_list_t *list = list_head; int eflag; eflag = pkg_cflags(world, list, maxdepth, flags | PKGF_SEARCH_PRIVATE); @@ -371,7 +371,7 @@ apply_cflags(pkg_t *world, void *list_head, int maxdepth, unsigned int flags) static bool apply_libs(pkg_t *world, void *list_head, int maxdepth, unsigned int flags) { - pkg_list_t *list = list_head; + pkgconf_list_t *list = list_head; int eflag; eflag = pkg_libs(world, list, maxdepth, flags); @@ -391,11 +391,11 @@ apply_libs(pkg_t *world, void *list_head, int maxdepth, unsigned int flags) static bool apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags) { - pkg_node_t *iter; + pkgconf_node_t *iter; (void) unused; (void) maxdepth; - PKG_FOREACH_LIST_ENTRY(world->requires.head, iter) + PKGCONF_FOREACH_LIST_ENTRY(world->requires.head, iter) { pkg_t *pkg; pkg_dependency_t *dep = iter->data; @@ -412,11 +412,11 @@ apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags) static bool apply_requires_private(pkg_t *world, void *unused, int maxdepth, unsigned int flags) { - pkg_node_t *iter; + pkgconf_node_t *iter; (void) unused; (void) maxdepth; - PKG_FOREACH_LIST_ENTRY(world->requires.head, iter) + PKGCONF_FOREACH_LIST_ENTRY(world->requires.head, iter) { pkg_t *pkg; pkg_dependency_t *dep = iter->data; @@ -455,7 +455,7 @@ apply_uninstalled(pkg_t *world, void *data, int maxdepth, unsigned int flags) static void print_graph_node(pkg_t *pkg, void *data, unsigned int flags) { - pkg_node_t *n; + pkgconf_node_t *n; (void) data; (void) flags; @@ -465,7 +465,7 @@ print_graph_node(pkg_t *pkg, void *data, unsigned int flags) if (pkg->version != NULL) printf(" version = '%s';\n", pkg->version); - PKG_FOREACH_LIST_ENTRY(pkg->requires.head, n) + PKGCONF_FOREACH_LIST_ENTRY(pkg->requires.head, n) { pkg_dependency_t *dep = n->data; printf(" dependency '%s'", dep->package); @@ -577,7 +577,7 @@ int main(int argc, char *argv[]) { int ret; - pkg_list_t pkgq = PKG_LIST_INITIALIZER; + pkgconf_list_t pkgq = PKGCONF_LIST_INITIALIZER; char *builddir; char *required_pkgconfig_version = NULL; char *required_exact_module_version = NULL; @@ -754,8 +754,8 @@ main(int argc, char *argv[]) if (required_module_version != NULL) { pkg_t *pkg; - pkg_node_t *node; - pkg_list_t deplist = PKG_LIST_INITIALIZER; + pkgconf_node_t *node; + pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; while (argv[pkg_optind]) { @@ -763,7 +763,7 @@ main(int argc, char *argv[]) pkg_optind++; } - PKG_FOREACH_LIST_ENTRY(deplist.head, node) + PKGCONF_FOREACH_LIST_ENTRY(deplist.head, node) { pkg_dependency_t *pkgiter = node->data; @@ -781,8 +781,8 @@ main(int argc, char *argv[]) if (required_exact_module_version != NULL) { pkg_t *pkg; - pkg_node_t *node; - pkg_list_t deplist = PKG_LIST_INITIALIZER; + pkgconf_node_t *node; + pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; while (argv[pkg_optind]) { @@ -790,7 +790,7 @@ main(int argc, char *argv[]) pkg_optind++; } - PKG_FOREACH_LIST_ENTRY(deplist.head, node) + PKGCONF_FOREACH_LIST_ENTRY(deplist.head, node) { pkg_dependency_t *pkgiter = node->data; @@ -808,8 +808,8 @@ main(int argc, char *argv[]) if (required_max_module_version != NULL) { pkg_t *pkg; - pkg_node_t *node; - pkg_list_t deplist = PKG_LIST_INITIALIZER; + pkgconf_node_t *node; + pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; while (argv[pkg_optind]) { @@ -817,7 +817,7 @@ main(int argc, char *argv[]) pkg_optind++; } - PKG_FOREACH_LIST_ENTRY(deplist.head, node) + PKGCONF_FOREACH_LIST_ENTRY(deplist.head, node) { pkg_dependency_t *pkgiter = node->data; @@ -975,7 +975,7 @@ main(int argc, char *argv[]) if ((want_flags & PKG_CFLAGS)) { - pkg_list_t frag_list = PKG_LIST_INITIALIZER; + pkgconf_list_t frag_list = PKGCONF_LIST_INITIALIZER; if (!pkg_queue_apply(&pkgq, apply_cflags, maximum_traverse_depth, global_traverse_flags, &frag_list)) { @@ -986,7 +986,7 @@ main(int argc, char *argv[]) if ((want_flags & PKG_LIBS)) { - pkg_list_t frag_list = PKG_LIST_INITIALIZER; + pkgconf_list_t frag_list = PKGCONF_LIST_INITIALIZER; if (!pkg_queue_apply(&pkgq, apply_libs, maximum_traverse_depth, global_traverse_flags, &frag_list)) {