From d9944828bfc3ab39f29b522aadedda6e5d978041 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sat, 21 Jan 2023 13:40:28 +0700 Subject: [PATCH v22 13/22] Get rid of NODE_IS_EMPTY macro It's already pretty clear what "count == 0" means, and the existing comments make it obvious. --- src/include/lib/radixtree.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/include/lib/radixtree.h b/src/include/lib/radixtree.h index 4a2dad82bf..567eab4bc8 100644 --- a/src/include/lib/radixtree.h +++ b/src/include/lib/radixtree.h @@ -372,7 +372,6 @@ typedef struct RT_NODE #endif #define NODE_IS_LEAF(n) (((RT_PTR_LOCAL) (n))->shift == 0) -#define NODE_IS_EMPTY(n) (((RT_PTR_LOCAL) (n))->count == 0) #define VAR_NODE_HAS_FREE_SLOT(node) \ ((node)->base.n.count < (node)->base.n.fanout) #define FIXED_NODE_HAS_FREE_SLOT(node, class) \ @@ -1701,7 +1700,7 @@ RT_DELETE(RT_RADIX_TREE *tree, uint64 key) * Return if the leaf node still has keys and we don't need to delete the * node. */ - if (!NODE_IS_EMPTY(node)) + if (node->count > 0) return true; /* Free the empty leaf node */ @@ -1717,7 +1716,7 @@ RT_DELETE(RT_RADIX_TREE *tree, uint64 key) Assert(deleted); /* If the node didn't become empty, we stop deleting the key */ - if (!NODE_IS_EMPTY(node)) + if (node->count > 0) break; /* The node became empty */ @@ -2239,7 +2238,6 @@ RT_DUMP(RT_RADIX_TREE *tree) /* locally declared macros */ #undef NODE_IS_LEAF -#undef NODE_IS_EMPTY #undef VAR_NODE_HAS_FREE_SLOT #undef FIXED_NODE_HAS_FREE_SLOT #undef RT_NODE_KIND_COUNT -- 2.39.0