From fabb32c493007568b30f3df6e1e7b54b4ffe1c8a Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 16 May 2017 02:04:37 +0100 Subject: [PATCH] replace 'pgp_uid_t' with 'struct PgpUid' --- gnupgparse.c | 6 +++--- pgpkey.c | 40 ++++++++++++++++++++-------------------- pgplib.c | 12 ++++++------ pgplib.h | 10 +++++----- pgppubring.c | 8 ++++---- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/gnupgparse.c b/gnupgparse.c index 6f08c2cda..4bc10cd83 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -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; diff --git a/pgpkey.c b/pgpkey.c index 537a0034d..a5e6fc88e 100644 --- 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; diff --git a/pgplib.c b/pgplib.c index 4a2f6ed22..14034e5a8 100644 --- 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); diff --git a/pgplib.h b/pgplib.h index 9d657380c..cb29128b9 100644 --- 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); diff --git a/pgppubring.c b/pgppubring.c index 0065fe50e..e2915fcbf 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -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; -- 2.40.0