mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
363ed2e892
commit
a9cbdcfd9c
22
g10/getkey.c
22
g10/getkey.c
@ -367,7 +367,7 @@ getkey_disable_caches ()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pubkey_free (struct pubkey *key)
|
pubkey_free (pubkey_t key)
|
||||||
{
|
{
|
||||||
if (key)
|
if (key)
|
||||||
{
|
{
|
||||||
@ -378,11 +378,11 @@ pubkey_free (struct pubkey *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pubkeys_free (struct pubkey *keys)
|
pubkeys_free (pubkey_t keys)
|
||||||
{
|
{
|
||||||
while (keys)
|
while (keys)
|
||||||
{
|
{
|
||||||
struct pubkey *next = keys->next;
|
pubkey_t next = keys->next;
|
||||||
pubkey_free (keys);
|
pubkey_free (keys);
|
||||||
keys = next;
|
keys = next;
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ gpg_error_t
|
|||||||
get_pubkeys (ctrl_t ctrl,
|
get_pubkeys (ctrl_t ctrl,
|
||||||
char *search_terms, int use, int include_unusable, char *source,
|
char *search_terms, int use, int include_unusable, char *source,
|
||||||
int warn_possibly_ambiguous,
|
int warn_possibly_ambiguous,
|
||||||
struct pubkey **keys)
|
pubkey_t *r_keys)
|
||||||
{
|
{
|
||||||
/* We show a warning when a key appears multiple times in the DB.
|
/* We show a warning when a key appears multiple times in the DB.
|
||||||
This can happen for two reasons:
|
This can happen for two reasons:
|
||||||
@ -442,8 +442,8 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
|
|
||||||
GETKEY_CTX ctx;
|
GETKEY_CTX ctx;
|
||||||
struct pubkey *results = NULL;
|
pubkey_t results = NULL;
|
||||||
struct pubkey *r;
|
pubkey_t r;
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
__func__, source ? source : "user input", search_terms);
|
__func__, source ? source : "user input", search_terms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*keys)
|
if (*r_keys)
|
||||||
log_bug ("%s: KEYS should be NULL!\n", __func__);
|
log_bug ("%s: KEYS should be NULL!\n", __func__);
|
||||||
|
|
||||||
switch (use)
|
switch (use)
|
||||||
@ -571,9 +571,9 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
count = 0;
|
count = 0;
|
||||||
for (r = results; r; r = r->next)
|
for (r = results; r; r = r->next)
|
||||||
{
|
{
|
||||||
struct pubkey **prevp;
|
pubkey_t *prevp;
|
||||||
struct pubkey *next;
|
pubkey_t next;
|
||||||
struct pubkey *r2;
|
pubkey_t r2;
|
||||||
int dups = 0;
|
int dups = 0;
|
||||||
|
|
||||||
prevp = &r->next;
|
prevp = &r->next;
|
||||||
@ -639,7 +639,7 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*keys = results;
|
*r_keys = results;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
11
g10/keydb.h
11
g10/keydb.h
@ -486,19 +486,20 @@ int get_pubkey_fast ( PKT_public_key *pk, u32 *keyid );
|
|||||||
KBNODE get_pubkeyblock( u32 *keyid );
|
KBNODE get_pubkeyblock( u32 *keyid );
|
||||||
|
|
||||||
/* A list used by get_pubkeys to gather all of the matches. */
|
/* 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). */
|
/* The key to use (either the public key or the subkey). */
|
||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
kbnode_t keyblock;
|
kbnode_t keyblock;
|
||||||
};
|
};
|
||||||
|
typedef struct pubkey_s *pubkey_t;
|
||||||
|
|
||||||
/* Free a single key. This does not remove key from any list! */
|
/* 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. */
|
/* 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.
|
/* Returns all keys that match the search specfication SEARCH_TERMS.
|
||||||
The returned keys should be freed using pubkeys_free. */
|
The returned keys should be freed using pubkeys_free. */
|
||||||
@ -506,7 +507,7 @@ gpg_error_t
|
|||||||
get_pubkeys (ctrl_t ctrl,
|
get_pubkeys (ctrl_t ctrl,
|
||||||
char *search_terms, int use, int include_unusable, char *source,
|
char *search_terms, int use, int include_unusable, char *source,
|
||||||
int warn_possibly_ambiguous,
|
int warn_possibly_ambiguous,
|
||||||
struct pubkey **keys);
|
pubkey_t *r_keys);
|
||||||
|
|
||||||
/* Find a public key identified by the name NAME.
|
/* Find a public key identified by the name NAME.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user