X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/5913c95f2c7abf4c3cb06e27d384d80fb4c83547..05d5b193ee05a187d4f3fd05a4be1fbb6bf937b6:/keydb.c?ds=sidebyside diff --git a/keydb.c b/keydb.c index 3fe3d34..347b406 100644 --- a/keydb.c +++ b/keydb.c @@ -4,6 +4,8 @@ * Jonathan McDowell * * Copyright 2002 Project Purple + * + * $Id: keydb.c,v 1.9 2003/06/04 20:57:08 noodles Exp $ */ /** @@ -95,28 +97,22 @@ struct ll *getkeysigs(uint64_t keyid) struct ll *cached_getkeysigs(uint64_t keyid) { struct stats_key *key = NULL; + struct stats_key *signedkey = NULL; + struct ll *cursig = NULL; if (keyid == 0) { return NULL; } - key = findinhash(keyid); - if (key == NULL) { - key = malloc(sizeof(*key)); - if (key != NULL) { - key->keyid = keyid; - key->colour = 0; - key->parent = 0; - key->sigs = NULL; - key->gotsigs = false; - addtohash(key); - } else { - perror("cached_getkeysigs()"); - return NULL; - } - } + key = createandaddtohash(keyid); + if (key->gotsigs == false) { key->sigs = getkeysigs(key->keyid); + for (cursig = key->sigs; cursig != NULL; + cursig = cursig->next) { + signedkey = (struct stats_key *) cursig->object; + signedkey->signs = lladd(signedkey->signs, key); + } key->gotsigs = true; }