commit:     d136dcae0c0b4a177e42ad42e1396e43a82c0a12
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon May  6 18:03:27 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon May  6 18:03:27 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d136dcae

qdepends: make atom calls cheaper for the majority of calls

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

 qdepends.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/qdepends.c b/qdepends.c
index e49e533..64bf991 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -116,7 +116,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
         * *DEPEND alters the search somewhat and affects results printing.
         */
 
-       datom = vdb_get_atom(pkg_ctx);
+       datom = vdb_get_atom(pkg_ctx, false);
        if (datom == NULL)
                return ret;
 
@@ -135,6 +135,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
 
                ret = 1;
 
+               datom = vdb_get_atom(pkg_ctx, true);
                printf("%s:", atom_format(state->format, datom, 0));
        }
 
@@ -172,8 +173,10 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
                                if (atom == NULL) {
                                        ret = 1;
 
-                                       if (!firstmatch)
+                                       if (!firstmatch) {
+                                               datom = vdb_get_atom(pkg_ctx, 
true);
                                                printf("%s:", 
atom_format(state->format, datom, 0));
+                                       }
                                        firstmatch = true;
 
                                        printf("\n%s=\"\n", *dfile);
@@ -199,8 +202,10 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
                                        if (fatom == NULL) {
                                                ret = 1;
 
-                                               if (!firstmatch)
+                                               if (!firstmatch) {
+                                                       datom = 
vdb_get_atom(pkg_ctx, true);
                                                        printf("%s:", 
atom_format(state->format, datom, 0));
+                                               }
                                                firstmatch = true;
 
                                                snprintf(buf, sizeof(buf), 
"%s%s%s",

Reply via email to