commit:     96a398aa2a3f63af154b3af12da5d5103b37b613
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon May  6 16:03:19 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon May  6 16:03:19 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=96a398aa

qdepends: use q_vdb_get_atom instead of constructing manually

Using vdb's atom, atom_format() will be able to print SLOT and REPO.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qdepends.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/qdepends.c b/qdepends.c
index 9cfe095..7bb8818 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -95,8 +95,6 @@ static int
 qdepends_results_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
 {
        struct qdepends_opt_state *state = priv;
-       const char *catname = pkg_ctx->cat_ctx->name;
-       const char *pkgname = pkg_ctx->name;
        depend_atom *atom;
        depend_atom *datom;
        depend_atom *fatom;
@@ -118,8 +116,7 @@ qdepends_results_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
         * *DEPEND alters the search somewhat and affects results printing.
         */
 
-       snprintf(buf, sizeof(buf), "%s/%s", catname, pkgname);
-       datom = atom_explode(buf);
+       datom = q_vdb_get_atom(pkg_ctx);
        if (datom == NULL)
                return ret;
 
@@ -133,10 +130,8 @@ qdepends_results_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
                }
 
                /* nothing matched */
-               if (atom != NULL) {
-                       atom_implode(datom);
+               if (atom != NULL)
                        return ret;
-               }
 
                ret = 1;
 
@@ -237,8 +232,6 @@ qdepends_results_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
                }
        }
 
-       atom_implode(datom);
-
        return ret;
 }
 

Reply via email to