1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-20 01:02:44 +02:00

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 <neal@g10code.com>.
This commit is contained in:
Neal H. Walfield 2015-09-14 15:31:25 +02:00
parent be6743b2e1
commit 65e58ae674
3 changed files with 14 additions and 22 deletions

View File

@ -400,7 +400,7 @@ get_pubkey (PKT_public_key * pk, u32 * keyid)
{ {
pk_from_block (&ctx, pk, kb, found_key); pk_from_block (&ctx, pk, kb, found_key);
} }
get_pubkey_end (&ctx); getkey_end (&ctx);
release_kbnode (kb); release_kbnode (kb);
} }
if (!rc) if (!rc)
@ -497,7 +497,7 @@ get_pubkeyblock (u32 * keyid)
ctx.items[0].u.kid[0] = keyid[0]; ctx.items[0].u.kid[0] = keyid[0];
ctx.items[0].u.kid[1] = keyid[1]; ctx.items[0].u.kid[1] = keyid[1];
rc = lookup (&ctx, &keyblock, NULL, 0); rc = lookup (&ctx, &keyblock, NULL, 0);
get_pubkey_end (&ctx); getkey_end (&ctx);
return rc ? NULL : keyblock; return rc ? NULL : keyblock;
} }
@ -532,7 +532,7 @@ get_seckey (PKT_public_key *pk, u32 *keyid)
{ {
pk_from_block (&ctx, pk, keyblock, found_key); pk_from_block (&ctx, pk, keyblock, found_key);
} }
get_pubkey_end (&ctx); getkey_end (&ctx);
release_kbnode (keyblock); release_kbnode (keyblock);
if (!err) if (!err)
@ -694,7 +694,7 @@ key_byname (GETKEY_CTX *retctx, strlist_t namelist,
*ret_kdbhd = ctx->kr_handle; *ret_kdbhd = ctx->kr_handle;
ctx->kr_handle = NULL; ctx->kr_handle = NULL;
} }
get_pubkey_end (ctx); getkey_end (ctx);
} }
return rc; return rc;
@ -792,7 +792,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
did_key_byname = 1; did_key_byname = 1;
if (retctx) if (retctx)
{ {
get_pubkey_end (*retctx); getkey_end (*retctx);
*retctx = NULL; *retctx = NULL;
} }
add_to_strlist (&namelist, name); add_to_strlist (&namelist, name);
@ -892,7 +892,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
{ {
if (retctx) if (retctx)
{ {
get_pubkey_end (*retctx); getkey_end (*retctx);
*retctx = NULL; *retctx = NULL;
} }
rc = key_byname (anylocalfirst ? 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) if (rc && retctx)
{ {
get_pubkey_end (*retctx); getkey_end (*retctx);
*retctx = NULL; *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 /* Search for a key with the given standard fingerprint. In contrast
* to get_pubkey_byfprint we assume a right padded fingerprint of the * 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 * 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) if (!err && pk)
pk_from_block (&ctx, pk, kb, found_key); pk_from_block (&ctx, pk, kb, found_key);
release_kbnode (kb); release_kbnode (kb);
get_pubkey_end (&ctx); getkey_end (&ctx);
return err; return err;
} }
@ -1007,7 +1000,7 @@ get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock,
} }
} }
release_kbnode (kb); release_kbnode (kb);
get_pubkey_end (&ctx); getkey_end (&ctx);
} }
else else
rc = GPG_ERR_GENERAL; /* Oops */ rc = GPG_ERR_GENERAL; /* Oops */
@ -1084,7 +1077,7 @@ get_keyblock_byfprint (KBNODE * ret_keyblock, const byte * fprint,
: KEYDB_SEARCH_MODE_FPR20); : KEYDB_SEARCH_MODE_FPR20);
memcpy (ctx.items[0].u.fpr, fprint, fprint_len); memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
rc = lookup (&ctx, ret_keyblock, NULL, 0); rc = lookup (&ctx, ret_keyblock, NULL, 0);
get_pubkey_end (&ctx); getkey_end (&ctx);
} }
else else
rc = GPG_ERR_GENERAL; /* Oops */ 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) if (!err && pk)
pk_from_block (&ctx, pk, kb, found_key); pk_from_block (&ctx, pk, kb, found_key);
release_kbnode (kb); release_kbnode (kb);
get_pubkey_end (&ctx); getkey_end (&ctx);
} }
else else
err = gpg_error (GPG_ERR_BUG); 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); ? KEYDB_SEARCH_MODE_FPR16 : KEYDB_SEARCH_MODE_FPR20);
memcpy (ctx.items[0].u.fpr, fprint, fprint_len); memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
err = lookup (&ctx, ret_keyblock, NULL, 1); err = lookup (&ctx, ret_keyblock, NULL, 1);
get_pubkey_end (&ctx); getkey_end (&ctx);
return err; return err;
} }

View File

@ -407,7 +407,6 @@ int get_pubkey_byname (ctrl_t ctrl,
GETKEY_CTX *rx, PKT_public_key *pk, const char *name, GETKEY_CTX *rx, PKT_public_key *pk, const char *name,
KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd, KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd,
int include_unusable, int no_akl ); int include_unusable, int no_akl );
void get_pubkey_end( GETKEY_CTX ctx );
gpg_error_t get_seckey (PKT_public_key *pk, u32 *keyid); gpg_error_t get_seckey (PKT_public_key *pk, u32 *keyid);
int get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock, int get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock,
const byte *fprint, size_t fprint_len); const byte *fprint, size_t fprint_len);

View File

@ -579,7 +579,7 @@ list_one (strlist_t names, int secret, int mark_secret)
if (rc) if (rc)
{ {
log_error ("error reading key: %s\n", gpg_strerror (rc)); log_error ("error reading key: %s\n", gpg_strerror (rc));
get_pubkey_end (ctx); getkey_end (ctx);
return; return;
} }
@ -638,7 +638,7 @@ locate_one (ctrl_t ctrl, strlist_t names)
release_kbnode (keyblock); release_kbnode (keyblock);
} }
while (ctx && !getkey_next (ctx, NULL, &keyblock)); while (ctx && !getkey_next (ctx, NULL, &keyblock));
get_pubkey_end (ctx); getkey_end (ctx);
ctx = NULL; ctx = NULL;
} }
} }