[Pkg-gnupg-commit] [gnupg2] 256/292: g10: Optimize key iteration.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Nov 21 06:31:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 12834e84aca9d74800245f0f2f2e6b5123e76173
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 15 15:33:09 2016 +0100

    g10: Optimize key iteration.
    
    * g10/getkey.c (get_best_pubkey_byname): Use the node returned by
    'getkey_next' instead of doing another lookup.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 g10/getkey.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/g10/getkey.c b/g10/getkey.c
index 7bc5c88..5792302 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -1593,9 +1593,9 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk,
     {
       /* Rank results and return only the most relevant key.  */
       struct pubkey_cmp_cookie best = { 0 }, new;
-      while (getkey_next (ctx, &new.key, NULL) == 0)
+      KBNODE new_keyblock;
+      while (getkey_next (ctx, &new.key, &new_keyblock) == 0)
         {
-          KBNODE new_keyblock = get_pubkeyblock (pk_keyid (&new.key));
           int diff = pubkey_cmp (ctrl, name, &best, &new, new_keyblock);
           release_kbnode (new_keyblock);
           if (diff < 0)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list