libpkgconf: pkg_queue becomes pkgconf_queue
parent
342950a5e4
commit
4410eb2c78
|
@ -130,7 +130,7 @@ struct pkg_ {
|
|||
|
||||
typedef void (*pkg_iteration_func_t)(const pkg_t *pkg);
|
||||
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags);
|
||||
typedef bool (*pkg_queue_apply_func_t)(pkg_t *world, void *data, int maxdepth, unsigned int flags);
|
||||
typedef bool (*pkgconf_queue_apply_func_t)(pkg_t *world, void *data, int maxdepth, unsigned int flags);
|
||||
|
||||
/* pkg.c */
|
||||
pkg_t *pkg_ref(pkg_t *pkg);
|
||||
|
@ -182,11 +182,11 @@ void pkgconf_tuple_define_global(const char *kv);
|
|||
extern FILE *error_msgout;
|
||||
|
||||
/* queue.c */
|
||||
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);
|
||||
void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
|
||||
bool pkgconf_queue_compile(pkg_t *world, 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_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags);
|
||||
|
||||
/* cache.c */
|
||||
pkg_t *pkgconf_cache_lookup(const char *id);
|
||||
|
|
|
@ -18,25 +18,25 @@
|
|||
typedef struct {
|
||||
pkgconf_node_t iter;
|
||||
char *package;
|
||||
} pkg_queue_t;
|
||||
} pkgconf_queue_t;
|
||||
|
||||
void
|
||||
pkg_queue_push(pkgconf_list_t *list, const char *package)
|
||||
pkgconf_queue_push(pkgconf_list_t *list, const char *package)
|
||||
{
|
||||
pkg_queue_t *pkgq = calloc(sizeof(pkg_queue_t), 1);
|
||||
pkgconf_queue_t *pkgq = calloc(sizeof(pkgconf_queue_t), 1);
|
||||
|
||||
pkgq->package = strdup(package);
|
||||
pkgconf_node_insert_tail(&pkgq->iter, pkgq, list);
|
||||
}
|
||||
|
||||
bool
|
||||
pkg_queue_compile(pkg_t *world, pkgconf_list_t *list)
|
||||
pkgconf_queue_compile(pkg_t *world, pkgconf_list_t *list)
|
||||
{
|
||||
pkgconf_node_t *iter;
|
||||
|
||||
PKGCONF_FOREACH_LIST_ENTRY(list->head, iter)
|
||||
{
|
||||
pkg_queue_t *pkgq;
|
||||
pkgconf_queue_t *pkgq;
|
||||
|
||||
pkgq = iter->data;
|
||||
pkgconf_dependency_parse(world, &world->requires, pkgq->package);
|
||||
|
@ -46,13 +46,13 @@ pkg_queue_compile(pkg_t *world, pkgconf_list_t *list)
|
|||
}
|
||||
|
||||
void
|
||||
pkg_queue_free(pkgconf_list_t *list)
|
||||
pkgconf_queue_free(pkgconf_list_t *list)
|
||||
{
|
||||
pkgconf_node_t *node, *tnode;
|
||||
|
||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, tnode, node)
|
||||
{
|
||||
pkg_queue_t *pkgq = node->data;
|
||||
pkgconf_queue_t *pkgq = node->data;
|
||||
|
||||
free(pkgq->package);
|
||||
free(pkgq);
|
||||
|
@ -60,16 +60,16 @@ pkg_queue_free(pkgconf_list_t *list)
|
|||
}
|
||||
|
||||
static inline unsigned int
|
||||
pkg_queue_verify(pkg_t *world, pkgconf_list_t *list, int maxdepth, unsigned int flags)
|
||||
pkgconf_queue_verify(pkg_t *world, pkgconf_list_t *list, int maxdepth, unsigned int flags)
|
||||
{
|
||||
if (!pkg_queue_compile(world, list))
|
||||
if (!pkgconf_queue_compile(world, list))
|
||||
return PKG_ERRF_DEPGRAPH_BREAK;
|
||||
|
||||
return pkg_verify_graph(world, maxdepth, flags);
|
||||
}
|
||||
|
||||
bool
|
||||
pkg_queue_apply(pkgconf_list_t *list, pkg_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 = {
|
||||
.id = "world",
|
||||
|
@ -81,7 +81,7 @@ pkg_queue_apply(pkgconf_list_t *list, pkg_queue_apply_func_t func, int maxdepth,
|
|||
if (!maxdepth)
|
||||
maxdepth = -1;
|
||||
|
||||
if (pkg_queue_verify(&world, list, maxdepth, flags) != PKG_ERRF_OK)
|
||||
if (pkgconf_queue_verify(&world, list, maxdepth, flags) != PKG_ERRF_OK)
|
||||
return false;
|
||||
|
||||
if (!func(&world, data, maxdepth, flags))
|
||||
|
@ -96,7 +96,7 @@ pkg_queue_apply(pkgconf_list_t *list, pkg_queue_apply_func_t func, int maxdepth,
|
|||
}
|
||||
|
||||
bool
|
||||
pkg_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;
|
||||
pkg_t world = {
|
||||
|
@ -109,7 +109,7 @@ pkg_queue_validate(pkgconf_list_t *list, int maxdepth, unsigned int flags)
|
|||
if (!maxdepth)
|
||||
maxdepth = -1;
|
||||
|
||||
if (pkg_queue_verify(&world, list, maxdepth, flags) != PKG_ERRF_OK)
|
||||
if (pkgconf_queue_verify(&world, list, maxdepth, flags) != PKG_ERRF_OK)
|
||||
retval = false;
|
||||
|
||||
pkg_free(&world);
|
||||
|
|
28
main.c
28
main.c
|
@ -850,7 +850,7 @@ main(int argc, char *argv[])
|
|||
|
||||
if (argv[pkg_optind + 1] == NULL || !PKG_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
|
||||
{
|
||||
pkg_queue_push(&pkgq, package);
|
||||
pkgconf_queue_push(&pkgq, package);
|
||||
pkg_optind++;
|
||||
}
|
||||
else
|
||||
|
@ -860,7 +860,7 @@ main(int argc, char *argv[])
|
|||
snprintf(packagebuf, sizeof packagebuf, "%s %s %s", package, argv[pkg_optind + 1], argv[pkg_optind + 2]);
|
||||
pkg_optind += 3;
|
||||
|
||||
pkg_queue_push(&pkgq, packagebuf);
|
||||
pkgconf_queue_push(&pkgq, packagebuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,14 +876,14 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_simulate, -1, global_traverse_flags | PKGF_SKIP_ERRORS, NULL))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_simulate, -1, global_traverse_flags | PKGF_SKIP_ERRORS, NULL))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pkg_queue_validate(&pkgq, maximum_traverse_depth, global_traverse_flags))
|
||||
if (!pkgconf_queue_validate(&pkgq, maximum_traverse_depth, global_traverse_flags))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -895,7 +895,7 @@ main(int argc, char *argv[])
|
|||
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
pkg_queue_apply(&pkgq, apply_uninstalled, maximum_traverse_depth, global_traverse_flags, &ret);
|
||||
pkgconf_queue_apply(&pkgq, apply_uninstalled, maximum_traverse_depth, global_traverse_flags, &ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -911,7 +911,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_digraph, maximum_traverse_depth, global_traverse_flags, NULL))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_digraph, maximum_traverse_depth, global_traverse_flags, NULL))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -922,7 +922,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_modversion, 2, global_traverse_flags, NULL))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_modversion, 2, global_traverse_flags, NULL))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -933,7 +933,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_variables, 2, global_traverse_flags, NULL))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_variables, 2, global_traverse_flags, NULL))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -944,7 +944,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_variable, 2, global_traverse_flags | PKGF_SKIP_ROOT_VIRTUAL, want_variable))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_variable, 2, global_traverse_flags | PKGF_SKIP_ROOT_VIRTUAL, want_variable))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -955,7 +955,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_requires, maximum_traverse_depth, global_traverse_flags, NULL))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_requires, maximum_traverse_depth, global_traverse_flags, NULL))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -966,7 +966,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_requires_private, maximum_traverse_depth, global_traverse_flags, NULL))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_requires_private, maximum_traverse_depth, global_traverse_flags, NULL))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
|
@ -977,7 +977,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
pkgconf_list_t frag_list = PKGCONF_LIST_INITIALIZER;
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_cflags, maximum_traverse_depth, global_traverse_flags, &frag_list))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_cflags, maximum_traverse_depth, global_traverse_flags, &frag_list))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out_println;
|
||||
|
@ -988,14 +988,14 @@ main(int argc, char *argv[])
|
|||
{
|
||||
pkgconf_list_t frag_list = PKGCONF_LIST_INITIALIZER;
|
||||
|
||||
if (!pkg_queue_apply(&pkgq, apply_libs, maximum_traverse_depth, global_traverse_flags, &frag_list))
|
||||
if (!pkgconf_queue_apply(&pkgq, apply_libs, maximum_traverse_depth, global_traverse_flags, &frag_list))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
goto out_println;
|
||||
}
|
||||
}
|
||||
|
||||
pkg_queue_free(&pkgq);
|
||||
pkgconf_queue_free(&pkgq);
|
||||
|
||||
out_println:
|
||||
if (want_flags & (PKG_CFLAGS|PKG_LIBS))
|
||||
|
|
Loading…
Reference in New Issue