pkg: clean up pkg_traverse() logic

feature/tap-sh
William Pitcock 2012-05-05 20:52:17 -05:00
parent faba0d8074
commit 4adb0b5dc6
2 changed files with 7 additions and 7 deletions

6
main.c
View File

@ -304,7 +304,7 @@ pkg_queue_walk(pkg_queue_t *head)
want_cflags = 0; want_cflags = 0;
want_libs = 0; want_libs = 0;
pkg_traverse(&world, print_modversion, NULL, 3, global_traverse_flags); pkg_traverse(&world, print_modversion, NULL, 2, global_traverse_flags);
} }
if (want_variables) if (want_variables)
@ -313,7 +313,7 @@ pkg_queue_walk(pkg_queue_t *head)
want_cflags = 0; want_cflags = 0;
want_libs = 0; want_libs = 0;
pkg_traverse(&world, print_variables, NULL, 3, global_traverse_flags); pkg_traverse(&world, print_variables, NULL, 2, global_traverse_flags);
} }
if (want_requires) if (want_requires)
@ -371,7 +371,7 @@ pkg_queue_walk(pkg_queue_t *head)
if (want_variable) if (want_variable)
{ {
wanted_something++; wanted_something++;
pkg_traverse(&world, print_variable, NULL, 3, global_traverse_flags); pkg_traverse(&world, print_variable, NULL, 2, global_traverse_flags);
} }
if (wanted_something) if (wanted_something)

8
pkg.c
View File

@ -349,7 +349,7 @@ static inline void
pkg_walk_list(pkg_dependency_t *deplist, pkg_walk_list(pkg_dependency_t *deplist,
void (*pkg_traverse_func)(pkg_t *package, void *data), void (*pkg_traverse_func)(pkg_t *package, void *data),
void *data, void *data,
int maxdepth, int depth,
unsigned int flags) unsigned int flags)
{ {
unsigned int eflags; unsigned int eflags;
@ -366,7 +366,7 @@ pkg_walk_list(pkg_dependency_t *deplist,
if (eflags != PKG_ERRF_OK) if (eflags != PKG_ERRF_OK)
return pkg_report_graph_error(pkgdep, node, eflags); return pkg_report_graph_error(pkgdep, node, eflags);
pkg_traverse(pkgdep, pkg_traverse_func, data, maxdepth - 1, flags); pkg_traverse(pkgdep, pkg_traverse_func, data, depth - 1, flags);
} }
} }
@ -385,10 +385,10 @@ pkg_traverse(pkg_t *root,
if (maxdepth == 0) if (maxdepth == 0)
return; return;
pkg_walk_list(root->requires, pkg_traverse_func, data, maxdepth - 1, flags); pkg_walk_list(root->requires, pkg_traverse_func, data, maxdepth, flags);
if (flags & PKGF_SEARCH_PRIVATE) if (flags & PKGF_SEARCH_PRIVATE)
pkg_walk_list(root->requires_private, pkg_traverse_func, data, maxdepth - 1, flags); pkg_walk_list(root->requires_private, pkg_traverse_func, data, maxdepth, flags);
if (pkg_traverse_func != NULL) if (pkg_traverse_func != NULL)
pkg_traverse_func(root, data); pkg_traverse_func(root, data);