Only seed database for Debian install if we're using default config
[onak.git] / hash.c
diff --git a/hash.c b/hash.c
index f07017a669d7e65342ce81637d801d0548bb9f59..66ae5e54dccfbf3984b54c6807946c8024c8845b 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -8,12 +8,12 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #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.
@@ -55,7 +55,7 @@ void destroyhash(void)
                 * TODO: The problem is the object has pointers that
                 * need freed too.
                 */
-               llfree(curll, free);
+               llfree(curll, (void (*)(void *)) free_statskey);
                hashtable[i] = NULL;
        }
        elements = 0;
@@ -121,42 +121,7 @@ unsigned long hashelements(void)
        return elements;
 }
 
-struct ll *gethashtableentry(int entry)
+struct ll *gethashtableentry(unsigned 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;
-}