Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/
Date: Mon, 14 Jun 2021 09:34:19
Message-Id: 1623596723.e8f5295c91f6e818455eac7414b17965ccbba061.grobian@gentoo
1 commit: e8f5295c91f6e818455eac7414b17965ccbba061
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jun 13 15:05:23 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 13 15:05:23 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e8f5295c
7
8 libq/tree: make some declarations const
9
10 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
11
12 libq/tree.c | 9 +++++----
13 libq/tree.h | 7 ++++---
14 2 files changed, 9 insertions(+), 7 deletions(-)
15
16 diff --git a/libq/tree.c b/libq/tree.c
17 index a247f66..5a505f2 100644
18 --- a/libq/tree.c
19 +++ b/libq/tree.c
20 @@ -468,7 +468,7 @@ tree_next_pkg_int(tree_cat_ctx *cat_ctx)
21 {
22 tree_pkg_ctx *pkg_ctx = NULL;
23 const struct dirent *de;
24 - depend_atom *qa = cat_ctx->ctx->query_atom;
25 + const depend_atom *qa = cat_ctx->ctx->query_atom;
26
27 if (cat_ctx->ctx->do_sort) {
28 if (cat_ctx->pkg_ctxs == NULL) {
29 @@ -1349,7 +1349,7 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb callback, void *priv)
30 char pkgname[_Q_PATH_MAX];
31 size_t len;
32 int ret = 0;
33 - depend_atom *query = ctx->query_atom;
34 + const depend_atom *query = ctx->query_atom;
35
36 /* reused for every entry */
37 tree_cat_ctx *cat = NULL;
38 @@ -1510,7 +1510,7 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb callback, void *priv)
39
40 int
41 tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, void *priv,
42 - bool sort, depend_atom *query)
43 + bool sort, const depend_atom *query)
44 {
45 tree_cat_ctx *cat_ctx;
46 tree_pkg_ctx *pkg_ctx;
47 @@ -1698,7 +1698,7 @@ tree_match_atom_cache_populate_cb(tree_pkg_ctx *ctx, void *priv)
48 }
49
50 tree_match_ctx *
51 -tree_match_atom(tree_ctx *ctx, depend_atom *query, int flags)
52 +tree_match_atom(tree_ctx *ctx, const depend_atom *query, int flags)
53 {
54 tree_cat_ctx *cat_ctx;
55 tree_pkg_ctx *pkg_ctx;
56 @@ -1779,6 +1779,7 @@ tree_match_atom(tree_ctx *ctx, depend_atom *query, int flags)
57 /* create a new match result */ \
58 n = xzalloc(sizeof(tree_match_ctx)); \
59 n->atom = atom; \
60 + n->pkg = pkg_ctx; \
61 snprintf(n->path, sizeof(n->path), "%s/%s/%s%s", \
62 (char *)C->ctx->path, C->name, pkg_ctx->name, \
63 C->ctx->cachetype == CACHE_EBUILD ? ".ebuild" : \
64
65 diff --git a/libq/tree.h b/libq/tree.h
66 index 1f28205..0aa534d 100644
67 --- a/libq/tree.h
68 +++ b/libq/tree.h
69 @@ -45,7 +45,7 @@ struct tree_ctx {
70 char *repo;
71 char *pkgs;
72 size_t pkgslen;
73 - depend_atom *query_atom;
74 + const depend_atom *query_atom;
75 struct tree_cache {
76 char *store;
77 size_t storesize;
78 @@ -125,6 +125,7 @@ struct tree_metadata_xml {
79 * (populated and deep copied) when set */
80 struct tree_match_ctx {
81 depend_atom *atom;
82 + tree_pkg_ctx *pkg;
83 tree_pkg_meta *meta;
84 char path[_Q_PATH_MAX + 48];
85 tree_match_ctx *next;
86 @@ -151,14 +152,14 @@ tree_metadata_xml *tree_pkg_metadata(tree_pkg_ctx *pkg_ctx);
87 void tree_close_metadata(tree_metadata_xml *meta_ctx);
88 void tree_close_pkg(tree_pkg_ctx *pkg_ctx);
89 int tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, void *priv,
90 - bool sort, depend_atom *query);
91 + bool sort, const depend_atom *query);
92 #define tree_foreach_pkg_fast(ctx, cb, priv, query) \
93 tree_foreach_pkg(ctx, cb, priv, false, query);
94 #define tree_foreach_pkg_sorted(ctx, cb, priv, query) \
95 tree_foreach_pkg(ctx, cb, priv, true, query);
96 set *tree_get_atoms(tree_ctx *ctx, bool fullcpv, set *satoms);
97 depend_atom *tree_get_atom(tree_pkg_ctx *pkg_ctx, bool complete);
98 -tree_match_ctx *tree_match_atom(tree_ctx *t, depend_atom *q, int flags);
99 +tree_match_ctx *tree_match_atom(tree_ctx *t, const depend_atom *q, int flags);
100 #define TREE_MATCH_FULL_ATOM (1<<1)
101 #define TREE_MATCH_METADATA (1<<2)
102 #define TREE_MATCH_LATEST (1<<3)