aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-12-23 14:45:20 +0000
committerWerner Koch <[email protected]>2015-12-23 14:46:09 +0000
commita9cbdcfd9c364557787f4a173cc59f14c067946e (patch)
treef5341d944cfd6cd5f35155681b6716400f969229
parentgpg: Simplify status message code from commit b30c15bf. (diff)
downloadgnupg-a9cbdcfd9c364557787f4a173cc59f14c067946e.tar.gz
gnupg-a9cbdcfd9c364557787f4a173cc59f14c067946e.zip
gpg: Rename struct pubkey to pukey_s and add pubkey_t.
* g10/keydb.h (struct pubkey): Rename to pubkey_s. (pubkey_t): New. Change all struct pubkey_s to use this type. * g10/getkey.c (get_pubkeys): Rename arg keys to r_keys. -- It is common in GnuPG to use a suffix of _s for struct names. There is no technical need for this (actually this pattern comes from pre ANSI C compilers which had no separate namespaces) but it avoid surprises when reading the code. Adding the pubkey_t type is mainly to improve font locking by using the common suffix _t for a typedefed type. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--g10/getkey.c22
-rw-r--r--g10/keydb.h11
2 files changed, 17 insertions, 16 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 26b1932f0..608b75ecb 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -367,7 +367,7 @@ getkey_disable_caches ()
void
-pubkey_free (struct pubkey *key)
+pubkey_free (pubkey_t key)
{
if (key)
{
@@ -378,11 +378,11 @@ pubkey_free (struct pubkey *key)
}
void
-pubkeys_free (struct pubkey *keys)
+pubkeys_free (pubkey_t keys)
{
while (keys)
{
- struct pubkey *next = keys->next;
+ pubkey_t next = keys->next;
pubkey_free (keys);
keys = next;
}
@@ -420,7 +420,7 @@ gpg_error_t
get_pubkeys (ctrl_t ctrl,
char *search_terms, int use, int include_unusable, char *source,
int warn_possibly_ambiguous,
- struct pubkey **keys)
+ pubkey_t *r_keys)
{
/* We show a warning when a key appears multiple times in the DB.
This can happen for two reasons:
@@ -442,8 +442,8 @@ get_pubkeys (ctrl_t ctrl,
KEYDB_SEARCH_DESC desc;
GETKEY_CTX ctx;
- struct pubkey *results = NULL;
- struct pubkey *r;
+ pubkey_t results = NULL;
+ pubkey_t r;
int count;
@@ -456,7 +456,7 @@ get_pubkeys (ctrl_t ctrl,
__func__, source ? source : "user input", search_terms);
}
- if (*keys)
+ if (*r_keys)
log_bug ("%s: KEYS should be NULL!\n", __func__);
switch (use)
@@ -571,9 +571,9 @@ get_pubkeys (ctrl_t ctrl,
count = 0;
for (r = results; r; r = r->next)
{
- struct pubkey **prevp;
- struct pubkey *next;
- struct pubkey *r2;
+ pubkey_t *prevp;
+ pubkey_t next;
+ pubkey_t r2;
int dups = 0;
prevp = &r->next;
@@ -639,7 +639,7 @@ get_pubkeys (ctrl_t ctrl,
}
}
else
- *keys = results;
+ *r_keys = results;
return err;
}
diff --git a/g10/keydb.h b/g10/keydb.h
index 66bfa57c0..f99136aa9 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -486,19 +486,20 @@ int get_pubkey_fast ( PKT_public_key *pk, u32 *keyid );
KBNODE get_pubkeyblock( u32 *keyid );
/* A list used by get_pubkeys to gather all of the matches. */
-struct pubkey
+struct pubkey_s
{
- struct pubkey *next;
+ struct pubkey_s *next;
/* The key to use (either the public key or the subkey). */
PKT_public_key *pk;
kbnode_t keyblock;
};
+typedef struct pubkey_s *pubkey_t;
/* Free a single key. This does not remove key from any list! */
-void pubkey_free (struct pubkey *key);
+void pubkey_free (pubkey_t key);
/* Free a list of public keys. */
-void pubkeys_free (struct pubkey *keys);
+void pubkeys_free (pubkey_t keys);
/* Returns all keys that match the search specfication SEARCH_TERMS.
The returned keys should be freed using pubkeys_free. */
@@ -506,7 +507,7 @@ gpg_error_t
get_pubkeys (ctrl_t ctrl,
char *search_terms, int use, int include_unusable, char *source,
int warn_possibly_ambiguous,
- struct pubkey **keys);
+ pubkey_t *r_keys);
/* Find a public key identified by the name NAME.