commit: e8f5295c91f6e818455eac7414b17965ccbba061
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 13 15:05:23 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jun 13 15:05:23 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e8f5295c
libq/tree: make some declarations const
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/tree.c | 9 +++++----
libq/tree.h | 7 ++++---
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/libq/tree.c b/libq/tree.c
index a247f66..5a505f2 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -468,7 +468,7 @@ tree_next_pkg_int(tree_cat_ctx *cat_ctx)
{
tree_pkg_ctx *pkg_ctx = NULL;
const struct dirent *de;
- depend_atom *qa = cat_ctx->ctx->query_atom;
+ const depend_atom *qa = cat_ctx->ctx->query_atom;
if (cat_ctx->ctx->do_sort) {
if (cat_ctx->pkg_ctxs == NULL) {
@@ -1349,7 +1349,7 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb
callback, void *priv)
char pkgname[_Q_PATH_MAX];
size_t len;
int ret = 0;
- depend_atom *query = ctx->query_atom;
+ const depend_atom *query = ctx->query_atom;
/* reused for every entry */
tree_cat_ctx *cat = NULL;
@@ -1510,7 +1510,7 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb
callback, void *priv)
int
tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, void *priv,
- bool sort, depend_atom *query)
+ bool sort, const depend_atom *query)
{
tree_cat_ctx *cat_ctx;
tree_pkg_ctx *pkg_ctx;
@@ -1698,7 +1698,7 @@ tree_match_atom_cache_populate_cb(tree_pkg_ctx *ctx, void
*priv)
}
tree_match_ctx *
-tree_match_atom(tree_ctx *ctx, depend_atom *query, int flags)
+tree_match_atom(tree_ctx *ctx, const depend_atom *query, int flags)
{
tree_cat_ctx *cat_ctx;
tree_pkg_ctx *pkg_ctx;
@@ -1779,6 +1779,7 @@ tree_match_atom(tree_ctx *ctx, depend_atom *query, int
flags)
/* create a new match result */ \
n = xzalloc(sizeof(tree_match_ctx)); \
n->atom = atom; \
+ n->pkg = pkg_ctx; \
snprintf(n->path, sizeof(n->path), "%s/%s/%s%s", \
(char *)C->ctx->path, C->name,
pkg_ctx->name, \
C->ctx->cachetype == CACHE_EBUILD ?
".ebuild" : \
diff --git a/libq/tree.h b/libq/tree.h
index 1f28205..0aa534d 100644
--- a/libq/tree.h
+++ b/libq/tree.h
@@ -45,7 +45,7 @@ struct tree_ctx {
char *repo;
char *pkgs;
size_t pkgslen;
- depend_atom *query_atom;
+ const depend_atom *query_atom;
struct tree_cache {
char *store;
size_t storesize;
@@ -125,6 +125,7 @@ struct tree_metadata_xml {
* (populated and deep copied) when set */
struct tree_match_ctx {
depend_atom *atom;
+ tree_pkg_ctx *pkg;
tree_pkg_meta *meta;
char path[_Q_PATH_MAX + 48];
tree_match_ctx *next;
@@ -151,14 +152,14 @@ tree_metadata_xml *tree_pkg_metadata(tree_pkg_ctx
*pkg_ctx);
void tree_close_metadata(tree_metadata_xml *meta_ctx);
void tree_close_pkg(tree_pkg_ctx *pkg_ctx);
int tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, void *priv,
- bool sort, depend_atom *query);
+ bool sort, const depend_atom *query);
#define tree_foreach_pkg_fast(ctx, cb, priv, query) \
tree_foreach_pkg(ctx, cb, priv, false, query);
#define tree_foreach_pkg_sorted(ctx, cb, priv, query) \
tree_foreach_pkg(ctx, cb, priv, true, query);
set *tree_get_atoms(tree_ctx *ctx, bool fullcpv, set *satoms);
depend_atom *tree_get_atom(tree_pkg_ctx *pkg_ctx, bool complete);
-tree_match_ctx *tree_match_atom(tree_ctx *t, depend_atom *q, int flags);
+tree_match_ctx *tree_match_atom(tree_ctx *t, const depend_atom *q, int flags);
#define TREE_MATCH_FULL_ATOM (1<<1)
#define TREE_MATCH_METADATA (1<<2)
#define TREE_MATCH_LATEST (1<<3)