hashtable: add strset to predefs
This commit is contained in:
parent
d32e53cb09
commit
528aec0688
1 changed files with 21 additions and 1 deletions
|
@ -222,6 +222,25 @@
|
|||
#define HT_THREAD_SAFE
|
||||
#include "hashtable_incproxy.inc.h"
|
||||
|
||||
/*
|
||||
* strset
|
||||
*
|
||||
* A hashset of strings
|
||||
*/
|
||||
#define HT_SUFFIX strset
|
||||
#define HT_KEY_TYPE char*
|
||||
#define HT_VALUE_TYPE struct ht_empty
|
||||
#define HT_FUNC_FREE_KEY(key) mem_free(key)
|
||||
#define HT_FUNC_KEYS_EQUAL(key1, key2) (!strcmp(key1, key2))
|
||||
#define HT_FUNC_HASH_KEY(key) htutil_hashfunc_string(key)
|
||||
#define HT_FUNC_COPY_KEY(dst, src) (*(dst) = strdup(src))
|
||||
#define HT_KEY_FMT "s"
|
||||
#define HT_KEY_PRINTABLE(key) (key)
|
||||
#define HT_VALUE_FMT "s"
|
||||
#define HT_VALUE_PRINTABLE(val) "(none)"
|
||||
#define HT_KEY_CONST
|
||||
#include "hashtable_incproxy.inc.h"
|
||||
|
||||
/*
|
||||
* C11 generic selection witchcraft.
|
||||
*/
|
||||
|
@ -235,7 +254,8 @@
|
|||
_HT_GENERIC_MAP(int2int, name), \
|
||||
_HT_GENERIC_MAP(int2ptr, name), \
|
||||
_HT_GENERIC_MAP(ptr2int, name), \
|
||||
_HT_GENERIC_MAP(ptr2ptr, name)
|
||||
_HT_GENERIC_MAP(ptr2ptr, name), \
|
||||
_HT_GENERIC_MAP(strset, name)
|
||||
|
||||
// Add all the thread-safe types here.
|
||||
#define _HT_GENERICLIST_TS(name) \
|
||||
|
|
Loading…
Reference in a new issue