commit:     d500e279f02bd5b58407975da145b1334c33e696
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 26 13:22:24 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Sep 26 13:22:24 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d500e279

libq/tree: simplify atom construction in tree_get_atoms_cb

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

 libq/tree.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libq/tree.c b/libq/tree.c
index f8d90ce..8caed00 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1061,10 +1061,9 @@ static int tree_get_atoms_cb(tree_pkg_ctx *pkg_ctx, void 
*priv)
        char abuf[BUFSIZ];
 
        if (state->fullcpv) {
-               size_t len = snprintf(abuf, sizeof(abuf), "%s/%s-%s",
-                               atom->CATEGORY, atom->PN, atom->PV);
-               if (atom->PR_int > 0)
-                       snprintf(abuf + len, sizeof(abuf) - len, "-r%d", 
atom->PR_int);
+               snprintf(abuf, sizeof(abuf), "%s/%s-%s",
+                               atom->CATEGORY, atom->PN,
+                               atom->PR_int > 0 ? atom->PVR : atom->PV);
                state->cpf = add_set(abuf, state->cpf);
        } else {
                snprintf(abuf, sizeof(abuf), "%s/%s", atom->CATEGORY, atom->PN);

Reply via email to