/* Structure of a generic hash. */
struct _hash
{
- hash_elem **table; /* Hash table. */
- size_t mask; /* Mask to trim hashed keys. */
- size_t table_size; /* Size of hash table. */
- size_t nmemb; /* Number of elements in hash table. */
+ hash_elem **table; /* Hash table. */
+ size_t mask; /* Mask to trim hashed keys. */
+ size_t table_size; /* Size of hash table. */
+ size_t nmemb; /* Number of elements in hash table. */
+ size_t index_table; /* Index for iterating hash table. */
+ hash_elem *index_bucket; /* Index for iterating buckets. */
};
typedef struct _hash hash;
/* Lookup a key in a given hash and return the hash element - or NULL if not found. */
hash_elem *hash_elem_get( hash *hash_pt, char *key );
+/* Get the next key/value pair from a hash table. */
+bool hash_each( hash *hash_pt, char **key_ppt, void *val );
+
/* Deallocate memory for hash and all hash elements. */
void hash_destroy( hash *hash_pt );