Forgot to remove some more .s strings and do a rename in order to prevent compiler...
[midnight-commander.git] / mhl / strhash.h
blob423ff09c3e6c4db3964a3a57b6fe171e4cfe6ed5
1 #ifndef MHL_STRHASH_H
2 #define MHL_STRHASH_H
4 #include <hash.h>
5 #include <mhl/memory.h>
7 static void __mhl_strhash_free_key(void* ptr)
9 g_free(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, \
22 hash_hash_string, \
23 hash_compare_string, \
24 hash_copy_string, \
25 __mhl_strhash_free_key, \
26 __mhl_strhash_free_dummy)
28 #define MHL_STRHASH_DECLARE_INIT(n) \
29 MHL_STRHASH_DECLARE(n); \
30 MHL_STRHASH_INIT(&n);
32 #define MHL_STRHASH_DEINIT(ht) \
33 hash_deinitialise(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)
42 void* retptr;
43 if (hash_retrieve(ht, (char*)key, &retptr))
44 return retptr;
45 else
46 return NULL;
49 #endif