commit:     ad34656e2d3cd6400c6debf3c46f39ab19219a6b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  2 12:45:52 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan  2 12:45:52 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ad34656e

libq/tree: allow tree_foreach_pkg to be called multiple times

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libq/tree.c b/libq/tree.c
index 0fdf9b1..570859e 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1339,6 +1339,11 @@ tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, 
void *priv,
                tree_close_cat(cat_ctx);
        }
 
+       /* allow foreach to be called again on the same open tree */
+       ctx->cat_de = NULL;
+       ctx->cat_cur = 0;
+       ctx->cat_cnt = 0;
+
        return ret;
 }
 

Reply via email to