add switch_hashtable_insert_destructor so you can insert a pointer into a hash with a custom destructor and use it in spandsp to fix a leak on reloadxml with the tone_descriptor tables and fix a bunch of random tiny leaks etc

This commit is contained in:
Anthony Minessale
2014-04-09 23:26:41 +05:00
parent d789c6470a
commit 4178688b4a
12 changed files with 56 additions and 37 deletions
+2 -1
View File
@@ -123,7 +123,8 @@ typedef enum {
} hashtable_flag_t;
SWITCH_DECLARE(int)
switch_hashtable_insert(switch_hashtable_t *h, void *k, void *v, hashtable_flag_t flags);
switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hashtable_flag_t flags, hashtable_destructor_t destructor);
#define switch_hashtable_insert(_h, _k, _v, _f) switch_hashtable_insert_destructor(_h, _k, _v, _f, NULL)
#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
int fnname (switch_hashtable_t *h, keytype *k, valuetype *v) \