commit: c7d98c2f2c2d98f8296139b19fd3920bc9e5c3fb
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 2 14:06:35 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan 2 14:06:35 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c7d98c2f
quse: push search atom down to tree_foreach_pkg when applicable
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
quse.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/quse.c b/quse.c
index a8585be..358d9e0 100644
--- a/quse.c
+++ b/quse.c
@@ -426,16 +426,9 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
int portdirfd = -1; /* pacify compiler */
if (state->match || state->do_describe) {
- atom = tree_get_atom(pkg_ctx, 0);
+ atom = tree_get_atom(pkg_ctx, false);
if (atom == NULL)
return 0;
-
- if (state->match) {
- match = atom_compare(atom, state->match) == EQUAL;
-
- if (!match)
- return 0;
- }
}
if (!state->do_licence) {
@@ -719,14 +712,15 @@ int quse_main(int argc, char **argv)
} else if (state.do_installed) {
tree_ctx *t = tree_open_vdb(portroot, portvdb);
state.overlay = NULL;
- tree_foreach_pkg_sorted(t, quse_results_cb, &state, NULL);
+ tree_foreach_pkg_sorted(t, quse_results_cb, &state,
state.match);
tree_close(t);
} else {
array_for_each(overlays, n, overlay) {
tree_ctx *t = tree_open(portroot, overlay);
state.overlay = overlay;
if (t != NULL) {
- tree_foreach_pkg_sorted(t, quse_results_cb,
&state, NULL);
+ tree_foreach_pkg_sorted(t, quse_results_cb,
+ &state, state.match);
tree_close(t);
}
}