1 |
commit: ad34656e2d3cd6400c6debf3c46f39ab19219a6b |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 2 12:45:52 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 2 12:45:52 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ad34656e |
7 |
|
8 |
libq/tree: allow tree_foreach_pkg to be called multiple times |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
libq/tree.c | 5 +++++ |
13 |
1 file changed, 5 insertions(+) |
14 |
|
15 |
diff --git a/libq/tree.c b/libq/tree.c |
16 |
index 0fdf9b1..570859e 100644 |
17 |
--- a/libq/tree.c |
18 |
+++ b/libq/tree.c |
19 |
@@ -1339,6 +1339,11 @@ tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, void *priv, |
20 |
tree_close_cat(cat_ctx); |
21 |
} |
22 |
|
23 |
+ /* allow foreach to be called again on the same open tree */ |
24 |
+ ctx->cat_de = NULL; |
25 |
+ ctx->cat_cur = 0; |
26 |
+ ctx->cat_cnt = 0; |
27 |
+ |
28 |
return ret; |
29 |
} |