#include "cddefines.h"
#include "hash.h"
Go to the source code of this file.
Enumerations | |
enum | { HASHINIT = 5381, HASHMUL = 33 } |
Functions | |
STATIC unsigned long | hashfunction (const void *t, const size_t len) |
STATIC entry * | lookup_key (const void *key, size_t *lkey, const hashtab *table, unsigned long *hk) |
STATIC void | extend (hashtab *table) |
STATIC unsigned long | getbin (unsigned long hk, const hashtab *table) |
hashtab * | newhash (void(*freedata)(void *)) |
void | freehash (hashtab *table) |
data_u * | addentry (const void *key, size_t lkey, hashtab *table, int *exists) |
data_u * | lookup (const void *key, size_t lkey, const hashtab *table) |
int | maxchain (const hashtab *table) |
unsigned long | makelist (const hashtab *table, data_u **list, const unsigned long nlist, int(*maskfun)(data_u *dat)) |
unsigned long | makeplist (const hashtab *table, void **list, const unsigned long nlist, int(*maskfun)(data_u *dat)) |
Definition at line 74 of file hash.cpp.
References entry::data, DEBUG_ENTRY, extend(), getbin(), entry::hashval, data_u::key, data_u::lkey, lookup_key(), MALLOC, hashtab::nelem, entry::next, and hashtab::tab.
Referenced by newelement(), newreact(), and newspecies().
STATIC void extend | ( | hashtab * | table | ) |
Definition at line 191 of file hash.cpp.
References DEBUG_ENTRY, hashtab::frontmask, hashtab::fullmask, entry::hashval, entry::next, REALLOC, hashtab::size, hashtab::space, and hashtab::tab.
Referenced by addentry().
void freehash | ( | hashtab * | table | ) |
Definition at line 48 of file hash.cpp.
References entry::data, DEBUG_ENTRY, hashtab::freedata, entry::next, data_u::p, hashtab::size, and hashtab::tab.
STATIC unsigned long getbin | ( | unsigned long | hk, | |
const hashtab * | table | |||
) |
Definition at line 234 of file hash.cpp.
References DEBUG_ENTRY, hashtab::frontmask, hashtab::fullmask, and hashtab::size.
Referenced by addentry(), and lookup_key().
STATIC unsigned long hashfunction | ( | const void * | t, | |
const size_t | len | |||
) |
Definition at line 108 of file hash.cpp.
References entry::data, lookup_key(), and hashtab::nelem.
Referenced by CO_findrate_s(), findelement(), and findspecies().
STATIC entry * lookup_key | ( | const void * | key, | |
size_t * | lkey, | |||
const hashtab * | table, | |||
unsigned long * | hk | |||
) |
Definition at line 163 of file hash.cpp.
References entry::data, DEBUG_ENTRY, getbin(), hashtab::hashfunction, entry::hashval, data_u::key, data_u::lkey, entry::next, and hashtab::tab.
Referenced by addentry(), and lookup().
unsigned long makelist | ( | const hashtab * | table, | |
data_u ** | list, | |||
const unsigned long | nlist, | |||
int(*)(data_u *dat) | maskfun | |||
) |
Definition at line 248 of file hash.cpp.
References cdEXIT, entry::data, DEBUG_ENTRY, ioQQQ, entry::next, hashtab::size, and hashtab::tab.
unsigned long makeplist | ( | const hashtab * | table, | |
void ** | list, | |||
const unsigned long | nlist, | |||
int(*)(data_u *dat) | maskfun | |||
) |
Definition at line 272 of file hash.cpp.
References cdEXIT, entry::data, DEBUG_ENTRY, ioQQQ, entry::next, data_u::p, hashtab::size, and hashtab::tab.
Referenced by CO_create_react(), and CO_Init().
int maxchain | ( | const hashtab * | table | ) |
Definition at line 121 of file hash.cpp.
References DEBUG_ENTRY, max(), entry::next, hashtab::size, and hashtab::tab.
hashtab* newhash | ( | void(*)(void *) | freedata | ) |
Definition at line 28 of file hash.cpp.
References DEBUG_ENTRY, hashfunction(), and MALLOC.
Referenced by CO_Init().