From 65e58ae6748c280c8633d2ca5f227ebe1220805d Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Mon, 14 Sep 2015 15:31:25 +0200 Subject: [PATCH] g10: Eliminate the redundant function get_pubkey_end. * g10/keydb.h (get_pubkey_end): Remove declaration. Replace use of function with getkey_end. * g10/getkey.c (get_pubkey_byname): Remove function. -- Signed-off-by: Neal H. Walfield . --- g10/getkey.c | 31 ++++++++++++------------------- g10/keydb.h | 1 - g10/keylist.c | 4 ++-- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/g10/getkey.c b/g10/getkey.c index 4e031f2da..626c7a7ff 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -400,7 +400,7 @@ get_pubkey (PKT_public_key * pk, u32 * keyid) { pk_from_block (&ctx, pk, kb, found_key); } - get_pubkey_end (&ctx); + getkey_end (&ctx); release_kbnode (kb); } if (!rc) @@ -497,7 +497,7 @@ get_pubkeyblock (u32 * keyid) ctx.items[0].u.kid[0] = keyid[0]; ctx.items[0].u.kid[1] = keyid[1]; rc = lookup (&ctx, &keyblock, NULL, 0); - get_pubkey_end (&ctx); + getkey_end (&ctx); return rc ? NULL : keyblock; } @@ -532,7 +532,7 @@ get_seckey (PKT_public_key *pk, u32 *keyid) { pk_from_block (&ctx, pk, keyblock, found_key); } - get_pubkey_end (&ctx); + getkey_end (&ctx); release_kbnode (keyblock); if (!err) @@ -694,7 +694,7 @@ key_byname (GETKEY_CTX *retctx, strlist_t namelist, *ret_kdbhd = ctx->kr_handle; ctx->kr_handle = NULL; } - get_pubkey_end (ctx); + getkey_end (ctx); } return rc; @@ -792,7 +792,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, did_key_byname = 1; if (retctx) { - get_pubkey_end (*retctx); + getkey_end (*retctx); *retctx = NULL; } add_to_strlist (&namelist, name); @@ -892,7 +892,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, { if (retctx) { - get_pubkey_end (*retctx); + getkey_end (*retctx); *retctx = NULL; } rc = key_byname (anylocalfirst ? retctx : NULL, @@ -917,7 +917,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, if (rc && retctx) { - get_pubkey_end (*retctx); + getkey_end (*retctx); *retctx = NULL; } @@ -926,13 +926,6 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } -void -get_pubkey_end (GETKEY_CTX ctx) -{ - getkey_end (ctx); -} - - /* Search for a key with the given standard fingerprint. In contrast * to get_pubkey_byfprint we assume a right padded fingerprint of the * standard length. PK may be NULL to only put the result into the @@ -956,7 +949,7 @@ get_pubkey_byfpr (PKT_public_key *pk, const byte *fpr) if (!err && pk) pk_from_block (&ctx, pk, kb, found_key); release_kbnode (kb); - get_pubkey_end (&ctx); + getkey_end (&ctx); return err; } @@ -1007,7 +1000,7 @@ get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock, } } release_kbnode (kb); - get_pubkey_end (&ctx); + getkey_end (&ctx); } else rc = GPG_ERR_GENERAL; /* Oops */ @@ -1084,7 +1077,7 @@ get_keyblock_byfprint (KBNODE * ret_keyblock, const byte * fprint, : KEYDB_SEARCH_MODE_FPR20); memcpy (ctx.items[0].u.fpr, fprint, fprint_len); rc = lookup (&ctx, ret_keyblock, NULL, 0); - get_pubkey_end (&ctx); + getkey_end (&ctx); } else rc = GPG_ERR_GENERAL; /* Oops */ @@ -1149,7 +1142,7 @@ get_seckey_byfprint (PKT_public_key *pk, const byte * fprint, size_t fprint_len) if (!err && pk) pk_from_block (&ctx, pk, kb, found_key); release_kbnode (kb); - get_pubkey_end (&ctx); + getkey_end (&ctx); } else err = gpg_error (GPG_ERR_BUG); @@ -1178,7 +1171,7 @@ get_seckeyblock_byfprint (kbnode_t *ret_keyblock, ? KEYDB_SEARCH_MODE_FPR16 : KEYDB_SEARCH_MODE_FPR20); memcpy (ctx.items[0].u.fpr, fprint, fprint_len); err = lookup (&ctx, ret_keyblock, NULL, 1); - get_pubkey_end (&ctx); + getkey_end (&ctx); return err; } diff --git a/g10/keydb.h b/g10/keydb.h index 525d78c27..faa0cc975 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -407,7 +407,6 @@ int get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *rx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd, int include_unusable, int no_akl ); -void get_pubkey_end( GETKEY_CTX ctx ); gpg_error_t get_seckey (PKT_public_key *pk, u32 *keyid); int get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock, const byte *fprint, size_t fprint_len); diff --git a/g10/keylist.c b/g10/keylist.c index 8ced5ad9e..bfc6d49fa 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -579,7 +579,7 @@ list_one (strlist_t names, int secret, int mark_secret) if (rc) { log_error ("error reading key: %s\n", gpg_strerror (rc)); - get_pubkey_end (ctx); + getkey_end (ctx); return; } @@ -638,7 +638,7 @@ locate_one (ctrl_t ctrl, strlist_t names) release_kbnode (keyblock); } while (ctx && !getkey_next (ctx, NULL, &keyblock)); - get_pubkey_end (ctx); + getkey_end (ctx); ctx = NULL; } }