Unify the TRY_HOF naming a bit

This commit is contained in:
Juhani Krekelä 2018-08-11 20:30:57 +03:00
parent d5ac622d44
commit 034ee8c3ef

View file

@ -41,7 +41,7 @@ struct __free_list {
__try_tmp_##name.value\
)
#define HANDLE_ON_TRY_FAIL(freer_func, pointer) (\
#define TRY_HOF_HANDLE(freer_func, pointer) (\
__allocation = pointer,\
__free_list_node = malloc(sizeof(struct __free_list)),\
(__free_list_node == NULL ? (\
@ -55,8 +55,10 @@ struct __free_list {
)),\
__allocation\
)
#define FREE_ON_TRY_FAIL(pointer) HANDLE_ON_TRY_FAIL(free, pointer)
#define FREE_ON_TRY_FAIL(pointer) TRY_HOF_HANDLE(free, pointer)
// free() is passed as an argument to avoid errors in case the program uses
// no TRY functionality and doesn't include stdlib.h
static void __remove_free_list(struct __free_list **head, void *ptr, void (*free)(void*)) {
struct __free_list **current = head;
while (*current != NULL) {