# HG changeset patch # User Mike Becker # Date 1633712329 -7200 # Node ID 18f964adad1b31216ca0791e78c2b56ec063103f # Parent e5a4de4f1e03b13f9a3a909caf1e710a4f039316 move dereference operation into macro diff -r e5a4de4f1e03 -r 18f964adad1b src/tree.c --- a/src/tree.c Wed Oct 06 14:24:52 2021 +0200 +++ b/src/tree.c Fri Oct 08 18:58:49 2021 +0200 @@ -29,14 +29,14 @@ #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); // optional parent link if (loc_parent >= 0) { - *CX_TR_PTR(new_node, loc_parent) = *CX_TR_PTR(node, loc_parent); + CX_TR_PTR(new_node, loc_parent) = CX_TR_PTR(node, loc_parent); } } @@ -47,6 +47,6 @@ // optional parent link if (loc_parent >= 0) { - *CX_TR_PTR(new_node, loc_parent) = parent; + CX_TR_PTR(new_node, loc_parent) = parent; } }