change hash to use flags per entry for free on keys and values

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@566 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale
2008-09-26 16:39:46 +00:00
parent a3922ed7c8
commit 8811a8d02e
4 changed files with 23 additions and 12 deletions

View File

@@ -101,8 +101,15 @@ create_hashtable(unsigned int minsize,
* If in doubt, remove before insert.
*/
typedef enum {
HASHTABLE_FLAG_NONE = 0,
HASHTABLE_FLAG_FREE_KEY = (1 << 0),
HASHTABLE_FLAG_FREE_VALUE = (1 << 1)
} hashtable_flag_t;
int
hashtable_insert(struct hashtable *h, void *k, void *v);
hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags);
#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
int fnname (struct hashtable *h, keytype *k, valuetype *v) \
@@ -167,7 +174,7 @@ hashtable_count(struct hashtable *h);
*/
void
hashtable_destroy(struct hashtable *h, int free_keys, int free_values);
hashtable_destroy(struct hashtable *h);
struct hashtable_iterator *hashtable_first(struct hashtable *h);
struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i);