]> granicus.if.org Git - neomutt/commitdiff
replace 'pgp_uid_t' with 'struct PgpUid'
authorRichard Russon <rich@flatcap.org>
Tue, 16 May 2017 01:04:37 +0000 (02:04 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 16 May 2017 11:12:58 +0000 (12:12 +0100)
gnupgparse.c
pgpkey.c
pgplib.c
pgplib.h
pgppubring.c

index 6f08c2cda9e1446da7e124a0915c04be71cdbe85..4bc10cd8330c58f06e9385943da8c27e30122a14 100644 (file)
@@ -109,7 +109,7 @@ static void fix_uid(char *uid)
 
 static struct PgpKeyInfo *parse_pub_line(char *buf, int *is_subkey, struct PgpKeyInfo *k)
 {
-  pgp_uid_t *uid = NULL;
+  struct PgpUid *uid = NULL;
   int field = 0, is_uid = 0;
   int is_pub = 0;
   int is_fpr = 0;
@@ -299,7 +299,7 @@ static struct PgpKeyInfo *parse_pub_line(char *buf, int *is_subkey, struct PgpKe
 
         mutt_debug(2, "user ID: %s\n", NONULL(p));
 
-        uid = safe_calloc(sizeof(pgp_uid_t), 1);
+        uid = safe_calloc(sizeof(struct PgpUid), 1);
         fix_uid(p);
         uid->addr = safe_strdup(p);
         uid->trust = trust;
@@ -405,7 +405,7 @@ struct PgpKeyInfo *pgp_get_candidates(pgp_ring_t keyring, struct List *hints)
 
       if (is_sub)
       {
-        pgp_uid_t **l;
+        struct PgpUid **l;
 
         k->flags |= KEYFLAG_SUBKEY;
         k->parent = mainkey;
index 537a0034d108bbb4df5f34b2b1cf87df29ef4574..a5e6fc88ef9c84564ffa67bb8c4575e2f752c289 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -106,7 +106,7 @@ static struct PgpKeyInfo *pgp_principal_key(struct PgpKeyInfo *key)
 struct PgpEntry
 {
   size_t num;
-  pgp_uid_t *uid;
+  struct PgpUid *uid;
 };
 
 static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int cols,
@@ -116,7 +116,7 @@ static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int col
 {
   char fmt[16];
   struct PgpEntry *entry = NULL;
-  pgp_uid_t *uid = NULL;
+  struct PgpUid *uid = NULL;
   struct PgpKeyInfo *key = NULL, *pkey = NULL;
   int kflags = 0;
   int optional = (flags & MUTT_FORMAT_OPTIONAL);
@@ -268,7 +268,7 @@ static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int col
 
 static void pgp_entry(char *s, size_t l, struct Menu *menu, int num)
 {
-  pgp_uid_t **KeyTable = (pgp_uid_t **) menu->data;
+  struct PgpUid **KeyTable = (struct PgpUid **) menu->data;
   struct PgpEntry entry;
 
   entry.uid = KeyTable[num];
@@ -282,8 +282,8 @@ static int _pgp_compare_address(const void *a, const void *b)
 {
   int r;
 
-  pgp_uid_t **s = (pgp_uid_t **) a;
-  pgp_uid_t **t = (pgp_uid_t **) b;
+  struct PgpUid **s = (struct PgpUid **) a;
+  struct PgpUid **t = (struct PgpUid **) b;
 
   if ((r = mutt_strcasecmp((*s)->addr, (*t)->addr)))
     return r > 0;
@@ -303,8 +303,8 @@ static int _pgp_compare_keyid(const void *a, const void *b)
 {
   int r;
 
-  pgp_uid_t **s = (pgp_uid_t **) a;
-  pgp_uid_t **t = (pgp_uid_t **) b;
+  struct PgpUid **s = (struct PgpUid **) a;
+  struct PgpUid **t = (struct PgpUid **) b;
 
   if ((r = mutt_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent))))
     return r > 0;
@@ -321,8 +321,8 @@ static int pgp_compare_keyid(const void *a, const void *b)
 static int _pgp_compare_date(const void *a, const void *b)
 {
   int r;
-  pgp_uid_t **s = (pgp_uid_t **) a;
-  pgp_uid_t **t = (pgp_uid_t **) b;
+  struct PgpUid **s = (struct PgpUid **) a;
+  struct PgpUid **t = (struct PgpUid **) b;
 
   if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
     return r > 0;
@@ -339,8 +339,8 @@ static int _pgp_compare_trust(const void *a, const void *b)
 {
   int r;
 
-  pgp_uid_t **s = (pgp_uid_t **) a;
-  pgp_uid_t **t = (pgp_uid_t **) b;
+  struct PgpUid **s = (struct PgpUid **) a;
+  struct PgpUid **t = (struct PgpUid **) b;
 
   if ((r = (((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)) -
             ((*t)->parent->flags & (KEYFLAG_RESTRICTIONS)))))
@@ -374,7 +374,7 @@ static bool pgp_key_is_valid(struct PgpKeyInfo *k)
   return true;
 }
 
-static bool pgp_id_is_strong(pgp_uid_t *uid)
+static bool pgp_id_is_strong(struct PgpUid *uid)
 {
   if ((uid->trust & 3) < 3)
     return false;
@@ -382,7 +382,7 @@ static bool pgp_id_is_strong(pgp_uid_t *uid)
   return true;
 }
 
-static bool pgp_id_is_valid(pgp_uid_t *uid)
+static bool pgp_id_is_valid(struct PgpUid *uid)
 {
   if (!pgp_key_is_valid(uid->parent))
     return false;
@@ -399,7 +399,7 @@ static bool pgp_id_is_valid(pgp_uid_t *uid)
 
 #define PGP_KV_MATCH (PGP_KV_ADDR | PGP_KV_STRING)
 
-static int pgp_id_matches_addr(struct Address *addr, struct Address *u_addr, pgp_uid_t *uid)
+static int pgp_id_matches_addr(struct Address *addr, struct Address *u_addr, struct PgpUid *uid)
 {
   int rv = 0;
 
@@ -423,7 +423,7 @@ static int pgp_id_matches_addr(struct Address *addr, struct Address *u_addr, pgp
 static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, struct Address *p, const char *s)
 {
   int keymax;
-  pgp_uid_t **KeyTable;
+  struct PgpUid **KeyTable;
   struct Menu *menu = NULL;
   int i, done = 0;
   char helpstr[LONG_STRING], buf[LONG_STRING], tmpbuf[STRING];
@@ -431,7 +431,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, struct Address
   FILE *fp = NULL, *devnull = NULL;
   pid_t thepid;
   struct PgpKeyInfo *kp = NULL;
-  pgp_uid_t *a = NULL;
+  struct PgpUid *a = NULL;
   int (*f)(const void *, const void *);
 
   int unusable = 0;
@@ -458,7 +458,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, struct Address
       if (i == keymax)
       {
         keymax += 5;
-        safe_realloc(&KeyTable, sizeof(pgp_uid_t *) * keymax);
+        safe_realloc(&KeyTable, sizeof(struct PgpUid *) * keymax);
       }
 
       KeyTable[i++] = a;
@@ -488,7 +488,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, struct Address
       f = pgp_compare_trust;
       break;
   }
-  qsort(KeyTable, i, sizeof(pgp_uid_t *), f);
+  qsort(KeyTable, i, sizeof(struct PgpUid *), f);
 
   helpstr[0] = 0;
   mutt_make_help(buf, sizeof(buf), _("Exit  "), MENU_PGP, OP_EXIT);
@@ -795,7 +795,7 @@ struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, pgp_ring
   struct PgpKeyInfo *a_valid_addrmatch_key = NULL;
   struct PgpKeyInfo *matches = NULL;
   struct PgpKeyInfo **last = &matches;
-  pgp_uid_t *q = NULL;
+  struct PgpUid *q = NULL;
 
   if (a && a->mailbox)
     hints = pgp_add_string_to_hints(hints, a->mailbox);
@@ -918,7 +918,7 @@ struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, pgp_ring_t keyring)
   struct PgpKeyInfo *matches = NULL;
   struct PgpKeyInfo **last = &matches;
   struct PgpKeyInfo *k = NULL, *kn = NULL;
-  pgp_uid_t *a = NULL;
+  struct PgpUid *a = NULL;
   short match;
   size_t l;
   const char *ps = NULL, *pl = NULL, *pfcopy = NULL, *phint = NULL;
index 4a2f6ed226fc80c09761bbf39dc76022e0cf79ae..14034e5a883ff49a47480048ebcd2e59ff4350e6 100644 (file)
--- a/pgplib.c
+++ b/pgplib.c
@@ -104,9 +104,9 @@ static void pgp_free_sig(struct PgpSignature **sigp)
   *sigp = NULL;
 }
 
-static void pgp_free_uid(pgp_uid_t **upp)
+static void pgp_free_uid(struct PgpUid **upp)
 {
-  pgp_uid_t *up = NULL, *q = NULL;
+  struct PgpUid *up = NULL, *q = NULL;
 
   if (!upp || !*upp)
     return;
@@ -121,14 +121,14 @@ static void pgp_free_uid(pgp_uid_t **upp)
   *upp = NULL;
 }
 
-pgp_uid_t *pgp_copy_uids(pgp_uid_t *up, struct PgpKeyInfo *parent)
+struct PgpUid *pgp_copy_uids(struct PgpUid *up, struct PgpKeyInfo *parent)
 {
-  pgp_uid_t *l = NULL;
-  pgp_uid_t **lp = &l;
+  struct PgpUid *l = NULL;
+  struct PgpUid **lp = &l;
 
   for (; up; up = up->next)
   {
-    *lp = safe_calloc(1, sizeof(pgp_uid_t));
+    *lp = safe_calloc(1, sizeof(struct PgpUid));
     (*lp)->trust = up->trust;
     (*lp)->flags = up->flags;
     (*lp)->addr = safe_strdup(up->addr);
index 9d657380c8ca0105fe9ea8a183339261717732b2..cb29128b9b79bbbe89139f891a23e3c4d072f9ab 100644 (file)
--- a/pgplib.h
+++ b/pgplib.h
@@ -36,7 +36,7 @@ struct PgpKeyInfo
 {
   char *keyid;
   char *fingerprint;
-  struct pgp_uid *address;
+  struct PgpUid *address;
   int flags;
   short keylen;
   time_t gen_time;
@@ -47,15 +47,15 @@ struct PgpKeyInfo
   struct PgpKeyInfo *next;
 };
 
-typedef struct pgp_uid
+struct PgpUid
 {
   char *addr;
   short trust;
   int flags;
   struct PgpKeyInfo *parent;
-  struct pgp_uid *next;
+  struct PgpUid *next;
   struct PgpSignature *sigs;
-} pgp_uid_t;
+};
 
 enum pgp_version
 {
@@ -70,7 +70,7 @@ enum pgp_version
 const char *pgp_pkalgbytype(unsigned char type);
 
 struct PgpKeyInfo *pgp_remove_key(struct PgpKeyInfo **klist, struct PgpKeyInfo *key);
-pgp_uid_t *pgp_copy_uids(pgp_uid_t *up, struct PgpKeyInfo *parent);
+struct PgpUid *pgp_copy_uids(struct PgpUid *up, struct PgpKeyInfo *parent);
 
 bool pgp_canencrypt(unsigned char type);
 bool pgp_cansign(unsigned char type);
index 0065fe50e41d45a5384dc7b1a77e56c7316ef381..e2915fcbfe45e814e1936874855a11aee1679a57 100644 (file)
@@ -98,7 +98,7 @@ static void pgpring_dump_signatures(struct PgpSignature *sig)
 
 static void pgpring_dump_keyblock(struct PgpKeyInfo *p)
 {
-  pgp_uid_t *uid = NULL;
+  struct PgpUid *uid = NULL;
   short first;
   struct tm *tp = NULL;
   time_t t;
@@ -626,8 +626,8 @@ static struct PgpKeyInfo *pgp_parse_keyblock(FILE *fp)
   struct PgpKeyInfo *root = NULL;
   struct PgpKeyInfo **last = &root;
   struct PgpKeyInfo *p = NULL;
-  pgp_uid_t *uid = NULL;
-  pgp_uid_t **addr = NULL;
+  struct PgpUid *uid = NULL;
+  struct PgpUid **addr = NULL;
   struct PgpSignature **lsig = NULL;
 
   fgetpos(fp, &pos);
@@ -724,7 +724,7 @@ static struct PgpKeyInfo *pgp_parse_keyblock(FILE *fp)
           chr[l - 1] = '\0';
         }
 
-        *addr = uid = safe_calloc(1, sizeof(pgp_uid_t)); /* XXX */
+        *addr = uid = safe_calloc(1, sizeof(struct PgpUid)); /* XXX */
         uid->addr = chr;
         uid->parent = p;
         uid->trust = 0;