commit: 5725e66ffa06bff4edf349e4afb834e66f671b69
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri May 10 12:01:44 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri May 10 12:01:44 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5725e66f
libq/tree: use tree_get_atom in tree_pkg_metadata
apart from that it is simpler, it also allows for reuse
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/tree.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/libq/tree.c b/libq/tree.c
index bb7eefa..c8b4b5e 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -821,7 +821,6 @@ tree_pkg_metadata(tree_pkg_ctx *pkg_ctx)
size_t len;
tree_metadata_xml *ret = NULL;
struct elist *emailw = NULL;
- char buf[_Q_PATH_MAX];
/* lame @$$ XML parsing, I don't want to pull in a real parser
* library because we only retrieve one element for now: email
@@ -832,13 +831,10 @@ tree_pkg_metadata(tree_pkg_ctx *pkg_ctx)
if (ctx->cachetype == CACHE_EBUILD) {
fd = openat(pkg_ctx->cat_ctx->fd, "metadata", O_RDONLY |
O_CLOEXEC);
} else {
- depend_atom *atom;
- snprintf(buf, sizeof(buf), "%s/%s",
- pkg_ctx->cat_ctx->name, pkg_ctx->name);
- atom = atom_explode(buf);
+ char buf[_Q_PATH_MAX];
+ depend_atom *atom = tree_get_atom(pkg_ctx, false);
snprintf(buf, sizeof(buf), "../../%s/%s/metadata.xml",
atom->CATEGORY, atom->PN);
- atom_implode(atom);
fd = openat(ctx->tree_fd, buf, O_RDONLY | O_CLOEXEC);
}