aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2015-09-14 19:14:00 +0000
committerNeal H. Walfield <[email protected]>2015-09-16 13:15:23 +0000
commit80dbf8006ffe52e77930b0a6dca9d8caba8c3fd5 (patch)
treee7f0387b8aab66310ab147bad4c288afb796caf5
parentg10: Eliminate the redundant function get_keyblock_byfprint. (diff)
downloadgnupg-80dbf8006ffe52e77930b0a6dca9d8caba8c3fd5.tar.gz
gnupg-80dbf8006ffe52e77930b0a6dca9d8caba8c3fd5.zip
g10: Simplify get_seckey_byname: it was never called with NAME not NULL.
* g10/keydb.h (get_seckey_byname): Rename from this... (get_seckey_default): ... to this. Drop the parameter name. Update users. * g10/getkey.c (get_seckey_byname): Rename from this... (get_seckey_default): ... to this. Drop the parameter name. Drop the code which assumed that NAME is not NULL. -- Signed-off-by: Neal H. Walfield <[email protected]>.
Diffstat (limited to '')
-rw-r--r--g10/getkey.c9
-rw-r--r--g10/keydb.h2
-rw-r--r--g10/pkclist.c2
3 files changed, 4 insertions, 9 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 5cb080750..70960667b 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -1029,19 +1029,14 @@ get_pubkey_byfprint_fast (PKT_public_key * pk,
* the default key. This functions checks that a corresponding secret
* key is available. With no secret key it does not succeeed. */
gpg_error_t
-get_seckey_byname (PKT_public_key *pk, const char *name)
+get_seckey_default (PKT_public_key *pk)
{
gpg_error_t err;
strlist_t namelist = NULL;
int include_unusable = 1;
- /* If we have no name, try to use the default secret key. If we
- have no default, we'll use the first usable one. */
-
- if (!name && opt.def_secret_key && *opt.def_secret_key)
+ if (opt.def_secret_key && *opt.def_secret_key)
add_to_strlist (&namelist, opt.def_secret_key);
- else if (name)
- add_to_strlist (&namelist, name);
else
include_unusable = 0;
diff --git a/g10/keydb.h b/g10/keydb.h
index 0bc60bfda..e160a87c8 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -419,7 +419,7 @@ int get_pubkey_byfprint_fast (PKT_public_key *pk,
whether there is some secret key with the specified key id. */
int have_secret_key_with_kid (u32 *keyid);
-gpg_error_t get_seckey_byname (PKT_public_key *pk, const char *name);
+gpg_error_t get_seckey_default (PKT_public_key *pk);
gpg_error_t get_seckey_byfprint (PKT_public_key *pk,
const byte *fprint, size_t fprint_len);
diff --git a/g10/pkclist.c b/g10/pkclist.c
index 68d281284..9996d1828 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -714,7 +714,7 @@ default_recipient(void)
if( !opt.def_recipient_self )
return NULL;
pk = xmalloc_clear( sizeof *pk );
- i = get_seckey_byname (pk, NULL);
+ i = get_seckey_default (pk);
if( i ) {
free_public_key( pk );
return NULL;