5 * new_table_init creates a table with the specified
6 * number of buckets (size).
7 * obj_size is the size of individual objects (key+value),
8 * the first function is the hash function (called with the
9 * size and the payload pointer)
10 * the second function is the compare function, to tell if two
11 * objects are the same (XXX we could spare this if we also
12 * pass a key_size and use a bcmp for comparisons)
13 * Not extensible at the moment.
14 * max_el and max_ratio currently unused.
17 struct new_hash_table * new_table_init (int size, int obj_size,
18 uint32_t (hash_fn)(const void *, uint32_t size),
19 int (cmp_fn)(const void*, const void*),
20 struct malloc_type *mtype);
22 /* add a new object to the table, return success/failure */
23 int new_table_insert_obj (struct new_hash_table *h, const void *obj);
26 * returns a pointer to the matching object or NULL if not found.
29 const void *new_table_extract_obj(struct new_hash_table *h, const void *key);
31 /* remove an object from the table */
32 int new_table_delete_obj(struct new_hash_table *h, const void *key);
33 void *new_table_destroy(struct new_hash_table *h);
35 /* return the number of elements in the table */
36 int new_table_get_element(const struct new_hash_table *h);
38 /* returns the first or next element. Works by hashing the
39 * current object and then finds the next one.
40 * If obj == NULL returns the first object in the table
42 const void *table_next(struct new_hash_table *h, const void *obj);