Mercurial > hg > th-libs
changeset 709:905d30063e45
Use the th_cfg_free() deallocator.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 Apr 2020 00:44:34 +0300 |
parents | a34715d51ea4 |
children | c1c37f6ca133 |
files | tests.c |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tests.c Mon Apr 27 00:44:15 2020 +0300 +++ b/tests.c Mon Apr 27 00:44:34 2020 +0300 @@ -389,9 +389,17 @@ } -void test_config_free(th_llist_t *node) +void test_config_free(th_cfgitem_t *node) { - th_free_r(&node->data); + switch (node->type) + { + case ITEM_STRING: + th_free(*(node->v.val_str)); + break; + + case ITEM_STRING_LIST: + break; + } } @@ -472,7 +480,7 @@ test_result(&ctx, th_llist_find_func(*plist, nostr, test_config_strcmp) == NULL); test_end(&ctx); - th_llist_free_func_node(*plist, test_config_free); + th_llist_free_func_data(*plist, th_free); *plist = NULL; } @@ -559,9 +567,8 @@ out: // Free the data for v_str_list th_io_close(fh); - th_llist_free_func_node(v_str_list, test_config_free); - v_str_list = NULL; - th_cfg_free(cfg); + th_llist_free_func_data(v_str_list, th_free); + th_cfg_free(cfg, test_config_free); }