aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2005-11-12 04:53:03 +0000
committerDavid Shaw <[email protected]>2005-11-12 04:53:03 +0000
commit40b9d5648ddcf29db0755bf40c33253a50224382 (patch)
treec0fb71b9214e7dd5599d1a4f3db6082732e176b4 /g10/parse-packet.c
parent* trustdb.c (clean_uid_from_key, clean_uids_from_key): Significantly (diff)
downloadgnupg-40b9d5648ddcf29db0755bf40c33253a50224382.tar.gz
gnupg-40b9d5648ddcf29db0755bf40c33253a50224382.zip
* trustdb.h, trustdb.c (clean_key): New function to handle key
cleaning from one convenient place. * options.h, import.c (parse_import_options, clean_sigs_from_all_uids, import_one): Reduce clean options to two: clean and minimize. * parse-packet.c (setup_user_id): Remove. (parse_user_id, parse_attribute): Just use xmalloc_clear instead.
Diffstat (limited to '')
-rw-r--r--g10/parse-packet.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index e5523beca..b67ad7f82 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -1966,32 +1966,15 @@ parse_attribute_subpkts(PKT_user_id *uid)
return count;
}
-static void setup_user_id(PACKET *packet)
-{
- packet->pkt.user_id->ref = 1;
- packet->pkt.user_id->attribs = NULL;
- packet->pkt.user_id->attrib_data = NULL;
- packet->pkt.user_id->attrib_len = 0;
- packet->pkt.user_id->is_primary = 0;
- packet->pkt.user_id->is_revoked = 0;
- packet->pkt.user_id->is_expired = 0;
- packet->pkt.user_id->expiredate = 0;
- packet->pkt.user_id->created = 0;
- packet->pkt.user_id->help_key_usage = 0;
- packet->pkt.user_id->help_key_expire = 0;
- packet->pkt.user_id->prefs = NULL;
- packet->pkt.user_id->namehash = NULL;
-}
static int
parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
{
byte *p;
- packet->pkt.user_id = xmalloc(sizeof *packet->pkt.user_id + pktlen);
+ packet->pkt.user_id = xmalloc_clear(sizeof *packet->pkt.user_id + pktlen);
packet->pkt.user_id->len = pktlen;
-
- setup_user_id(packet);
+ packet->pkt.user_id->ref=1;
p = packet->pkt.user_id->name;
for( ; pktlen; pktlen--, p++ )
@@ -2052,13 +2035,12 @@ parse_attribute( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
byte *p;
#define EXTRA_UID_NAME_SPACE 71
- packet->pkt.user_id = xmalloc(sizeof *packet->pkt.user_id
- + EXTRA_UID_NAME_SPACE);
-
- setup_user_id(packet);
-
+ packet->pkt.user_id = xmalloc_clear(sizeof *packet->pkt.user_id
+ + EXTRA_UID_NAME_SPACE);
+ packet->pkt.user_id->ref=1;
packet->pkt.user_id->attrib_data = xmalloc(pktlen);
packet->pkt.user_id->attrib_len = pktlen;
+
p = packet->pkt.user_id->attrib_data;
for( ; pktlen; pktlen--, p++ )
*p = iobuf_get_noeof(inp);