# HG changeset patch # User Mike Becker # Date 1666524736 -7200 # Node ID bb69ef3ad1f3bd94884a457b88f9bb8a58447c44 # Parent 7df0bcaecffa6448c8429b05b3a14cf41318192f enclose macro arguments in parenthesis diff -r 7df0bcaecffa -r bb69ef3ad1f3 src/linked_list.c --- a/src/linked_list.c Tue Oct 04 19:25:07 2022 +0200 +++ b/src/linked_list.c Sun Oct 23 13:32:16 2022 +0200 @@ -34,11 +34,11 @@ /* LOW LEVEL LINKED LIST FUNCTIONS */ -#define CX_LL_PTR(cur, off) (*(void**)(((char*)cur)+off)) +#define CX_LL_PTR(cur, off) (*(void**)(((char*)(cur))+(off))) #define ll_prev(node) CX_LL_PTR(node, loc_prev) #define ll_next(node) CX_LL_PTR(node, loc_next) #define ll_advance(node) CX_LL_PTR(node, loc_advance) -#define ll_data_f(node, follow_ptr) ((follow_ptr)?CX_LL_PTR(node, loc_data):(((char*)node)+loc_data)) +#define ll_data_f(node, follow_ptr) ((follow_ptr)?CX_LL_PTR(node, loc_data):(((char*)(node))+loc_data)) #define ll_data(node) ll_data_f(node,follow_ptr) void *cx_linked_list_at( diff -r 7df0bcaecffa -r bb69ef3ad1f3 src/tree.c --- a/src/tree.c Tue Oct 04 19:25:07 2022 +0200 +++ b/src/tree.c Sun Oct 23 13:32:16 2022 +0200 @@ -29,7 +29,7 @@ #include "cx/tree.h" #include "cx/linked_list.h" -#define CX_TR_PTR(cur, off) *((void**)(((char*)cur)+off)) +#define CX_TR_PTR(cur, off) *((void**)(((char*)(cur))+(off))) void cx_tree_add_sibling(void *node, ptrdiff_t loc_prev, ptrdiff_t loc_next, ptrdiff_t loc_parent, void *new_node) { cx_linked_list_add(&node, NULL, loc_prev, loc_next, new_node);