General Public License for more details.
*/
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* this is an open table keyed by strings
*/
-int
+void
hash_table_init(const char *name, hash_table_t *hash, int len)
{
if (hash->entries != NULL) {
- fprintf(stderr, "ERROR: %s called on a non empty hash table\n",
- __FUNCTION__);
- return -1;
+ opkg_msg(ERROR, "Internal error: non empty hash table.\n");
+ return;
}
memset(hash, 0, sizeof(hash_table_t));
hash->name = name;
hash->n_buckets = len;
hash->entries = xcalloc(hash->n_buckets, sizeof(hash_entry_t));
-
- return 0;
}
void
if (hash_entry->key)
{
if (strcmp(key, hash_entry->key) == 0) {
- // opkg_message(NULL, OPKG_DEBUG, "Function: %s. Key found for '%s' \n", __FUNCTION__, key);
hash->n_hits++;
return hash_entry->data;
}