[Pkg-gnupg-commit] [gnupg2] 66/159: gpg: Rename struct pubkey to pukey_s and add pubkey_t.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jan 27 13:23:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit a9cbdcfd9c364557787f4a173cc59f14c067946e
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Dec 23 15:45:20 2015 +0100

    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 at gnupg.org>
---
 g10/getkey.c | 22 +++++++++++-----------
 g10/keydb.h  | 11 ++++++-----
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/g10/getkey.c b/g10/getkey.c
index 26b1932..608b75e 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 66bfa57..f99136a 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.
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list