enclose macro arguments in parenthesis

Sun, 23 Oct 2022 13:32:16 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 23 Oct 2022 13:32:16 +0200
changeset 592
bb69ef3ad1f3
parent 591
7df0bcaecffa
child 593
ea9b41b5ebbc

enclose macro arguments in parenthesis

src/linked_list.c file | annotate | diff | comparison | revisions
src/tree.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/linked_list.c	Tue Oct 04 19:25:07 2022 +0200
     1.2 +++ b/src/linked_list.c	Sun Oct 23 13:32:16 2022 +0200
     1.3 @@ -34,11 +34,11 @@
     1.4  
     1.5  /* LOW LEVEL LINKED LIST FUNCTIONS */
     1.6  
     1.7 -#define CX_LL_PTR(cur, off) (*(void**)(((char*)cur)+off))
     1.8 +#define CX_LL_PTR(cur, off) (*(void**)(((char*)(cur))+(off)))
     1.9  #define ll_prev(node) CX_LL_PTR(node, loc_prev)
    1.10  #define ll_next(node) CX_LL_PTR(node, loc_next)
    1.11  #define ll_advance(node) CX_LL_PTR(node, loc_advance)
    1.12 -#define ll_data_f(node, follow_ptr) ((follow_ptr)?CX_LL_PTR(node, loc_data):(((char*)node)+loc_data))
    1.13 +#define ll_data_f(node, follow_ptr) ((follow_ptr)?CX_LL_PTR(node, loc_data):(((char*)(node))+loc_data))
    1.14  #define ll_data(node) ll_data_f(node,follow_ptr)
    1.15  
    1.16  void *cx_linked_list_at(
     2.1 --- a/src/tree.c	Tue Oct 04 19:25:07 2022 +0200
     2.2 +++ b/src/tree.c	Sun Oct 23 13:32:16 2022 +0200
     2.3 @@ -29,7 +29,7 @@
     2.4  #include "cx/tree.h"
     2.5  #include "cx/linked_list.h"
     2.6  
     2.7 -#define CX_TR_PTR(cur, off) *((void**)(((char*)cur)+off))
     2.8 +#define CX_TR_PTR(cur, off) *((void**)(((char*)(cur))+(off)))
     2.9  
    2.10  void cx_tree_add_sibling(void *node, ptrdiff_t loc_prev, ptrdiff_t loc_next, ptrdiff_t loc_parent, void *new_node) {
    2.11      cx_linked_list_add(&node, NULL, loc_prev, loc_next, new_node);

mercurial