hashtable: add strset to predefs

This commit is contained in:
Andrei Alexeyev 2023-01-11 13:00:59 +01:00
parent d32e53cb09
commit 528aec0688
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -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) \