1 #ifndef __MHL_STRHASH_H
2 #define __MHL_STRHASH_H
5 #include <mhl/memory.h>
7 static void __mhl_strhash_free_key(void* ptr
)
12 static void __mhl_strhash_free_dummy(void* ptr
)
16 typedef hash MHL_STRHASH
;
18 #define MHL_STRHASH_DECLARE(n) MHL_STRHASH n;
20 #define MHL_STRHASH_INIT(h) \
21 hash_initialise(h, 997U, \
23 hash_compare_string, \
25 __mhl_strhash_free_key, \
26 __mhl_strhash_free_dummy)
28 #define MHL_STRHASH_DECLARE_INIT(n) \
29 MHL_STRHASH_DECLARE(n); \
32 #define MHL_STRHASH_DEINIT(ht) \
35 static inline void mhl_strhash_addkey(MHL_STRHASH
* ht
, const char* key
, void* value
)
37 hash_insert(ht
, (char*)key
, value
);
40 static inline void* mhl_strhash_lookup(MHL_STRHASH
* ht
, const char* key
)
43 if (hash_retrieve(ht
, (char*)key
, &retptr
))