diff options
author | 2019-12-30 18:21:21 +0100 | |
---|---|---|
committer | 2019-12-30 18:21:21 +0100 | |
commit | c9e89dfa7cc3ae22bc3c731a3d617e4912bd831a (patch) | |
tree | ad0056af5d34ebb3b6de2221d8d7f3f2e1546282 /qsearch.c | |
parent | libq/tree: ensure valid pointers in case of realloc (diff) | |
download | portage-utils-c9e89dfa7cc3ae22bc3c731a3d617e4912bd831a.tar.gz portage-utils-c9e89dfa7cc3ae22bc3c731a3d617e4912bd831a.tar.bz2 portage-utils-c9e89dfa7cc3ae22bc3c731a3d617e4912bd831a.zip |
libq/tree: introduce a wrapper for retrieving ebuild metadata
To further hide the difference between trees, add a wrapper around
tree_get_meta, which deals with the underlying storage format. This is
most notably useful when dealing with vdb-based and binpkgs because they
have a specific or more expensive way of retrieval. This can now
properly be hidden from the q applets.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'qsearch.c')
-rw-r--r-- | qsearch.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -66,7 +66,6 @@ qsearch_cb(tree_pkg_ctx *pkg_ctx, void *priv) struct qsearch_state *state = (struct qsearch_state *)priv; depend_atom *atom; - tree_pkg_meta *meta; char *desc; bool match; @@ -84,17 +83,13 @@ qsearch_cb(tree_pkg_ctx *pkg_ctx, void *priv) match = true; desc = NULL; - meta = NULL; if ((match && (state->show_homepage || state->show_desc)) || (!match && state->search_desc)) { - meta = tree_pkg_read(pkg_ctx); - if (meta != NULL) { - if (state->show_homepage) - desc = meta->HOMEPAGE; - else if (state->show_desc) - desc = meta->DESCRIPTION; - } + if (state->show_homepage) + desc = tree_pkg_meta_get(pkg_ctx, HOMEPAGE); + else if (state->show_desc) + desc = tree_pkg_meta_get(pkg_ctx, DESCRIPTION); } if (!match && state->search_desc && desc != NULL && @@ -109,9 +104,6 @@ qsearch_cb(tree_pkg_ctx *pkg_ctx, void *priv) (state->show_name ? "" : desc ? desc : "")); } - if (meta != NULL) - tree_close_meta(meta); - if (last_atom != NULL) atom_implode(last_atom); last_atom = atom; |