hash_alloc - allocate a hash data structure
Synopsis
Description
Return Value
See Also
#include <hash.h>
struct hash *hash_alloc(int hashsize);
The hash_alloc() function allocates a hash data structure of the size given by hashsize. For speed hashsize is always rounded to the nearest power of two above the requested size.
The hash struct contains the following fields:
struct hash { int h_hashsize; /* Width of h_hash array */ ulong h_hashmask; /* Bit mask to match array size */ struct hash_node /* Chains under each hash value */ *h_hash[1]; };The hash_node struct in turn contains:
struct hash_node { struct hash_node *h_next; /* Next on hash chain */ long h_key; /* Key for this node */ void *h_data; /* ...corresponding value */ };The h_data pointer is then supposed to be pointed at your data.
If its successfull it returns a pointer to a hash structure of the given size. If unsuccessfull it returns NULL.
hash_dealloc(3), hash_insert(3), hash_delete(3), hash_lookup(3), hash_foreach(3), hash_size(3)
HASH_ALLOC (3) |