From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4C79E1382C5 for ; Mon, 14 Jun 2021 09:34:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 86B75E0C09; Mon, 14 Jun 2021 09:34:18 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 59E43E0B63 for ; Mon, 14 Jun 2021 09:34:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 56BCD340D5D for ; Mon, 14 Jun 2021 09:34:17 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D92E07AE for ; Mon, 14 Jun 2021 09:34:15 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1623596723.e8f5295c91f6e818455eac7414b17965ccbba061.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/tree.c libq/tree.h X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: e8f5295c91f6e818455eac7414b17965ccbba061 X-VCS-Branch: master Date: Mon, 14 Jun 2021 09:34:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 960e928a-c648-416e-a13e-83305c70e973 X-Archives-Hash: fbabf17d26cb62b0a57f5174155164e4 commit: e8f5295c91f6e818455eac7414b17965ccbba061 Author: Fabian Groffen gentoo org> AuthorDate: Sun Jun 13 15:05:23 2021 +0000 Commit: Fabian Groffen gentoo 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 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)