X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/7388adcea7ebace8d8c299da0e7c2e7e93da9c83..ce1c3225e865ba5748cd855d17d477bda90b7652:/hash.c?ds=inline diff --git a/hash.c b/hash.c index e29017c..9ee8b9b 100644 --- a/hash.c +++ b/hash.c @@ -4,16 +4,18 @@ * Jonathan McDowell * * Copyright 2000-2002 Project Purple + * + * $Id: hash.c,v 1.8 2003/06/04 20:57:08 noodles Exp $ */ #include #include +#include #include "hash.h" -#include "keydb.h" -#include "keyid.h" +#include "keystructs.h" #include "ll.h" -#include "stats.h" +#include "mem.h" /** * hashtable - the hash table array. @@ -48,20 +50,14 @@ void destroyhash(void) { int i; struct ll *curll = NULL; - struct ll *nextll = NULL; for (i = 0; i < HASHSIZE; i++) { curll = hashtable[i]; - while (curll != NULL) { - nextll = curll->next; - /* - * TODO: The problem is the object has pointers that - * need freed too. - */ - free(curll->object); - free(curll); - curll = nextll; - } + /* + * TODO: The problem is the object has pointers that + * need freed too. + */ + llfree(curll, free_statskey); hashtable[i] = NULL; } elements = 0; @@ -131,38 +127,3 @@ struct ll *gethashtableentry(int entry) { return hashtable[entry]; } - -/** - * hash_getkeysigs - Gets the signatures on a key. - * @keyid: The key we want the signatures for. - * - * This function gets the signatures on a key. It's the same as the - * getkeysigs function from the keydb module except we also cache the data - * so that if we need it again we already have it available. - */ -struct ll *hash_getkeysigs(uint64_t keyid) -{ - struct stats_key *key = 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("hash_getkeysigs()"); - return NULL; - } - } - if (key->gotsigs == false) { - key->sigs = getkeysigs(key->keyid); - key->gotsigs = true; - } - - return key->sigs; -}