Skip to content

Commit ed52df3

Browse files
committed
Small cosmetic fixes in radix tree template
- Bring memory context names in line with other naming - Fix typos, reported off-list by Alexander Lakhin - Remove copy-paste errors from comments - Remove duplicate #undef
1 parent 1713e3d commit ed52df3

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/include/lib/radixtree.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -643,27 +643,27 @@ typedef struct RT_SIZE_CLASS_ELEM
643643

644644
static const RT_SIZE_CLASS_ELEM RT_SIZE_CLASS_INFO[] = {
645645
[RT_CLASS_4] = {
646-
.name = RT_STR(RT_PREFIX) "radix_tree node4",
646+
.name = RT_STR(RT_PREFIX) "_radix_tree node4",
647647
.fanout = RT_FANOUT_4,
648648
.allocsize = sizeof(RT_NODE_4) + RT_FANOUT_4 * sizeof(RT_PTR_ALLOC),
649649
},
650650
[RT_CLASS_16_LO] = {
651-
.name = RT_STR(RT_PREFIX) "radix_tree node16_lo",
651+
.name = RT_STR(RT_PREFIX) "_radix_tree node16_lo",
652652
.fanout = RT_FANOUT_16_LO,
653653
.allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_LO * sizeof(RT_PTR_ALLOC),
654654
},
655655
[RT_CLASS_16_HI] = {
656-
.name = RT_STR(RT_PREFIX) "radix_tree node16_hi",
656+
.name = RT_STR(RT_PREFIX) "_radix_tree node16_hi",
657657
.fanout = RT_FANOUT_16_HI,
658658
.allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_HI * sizeof(RT_PTR_ALLOC),
659659
},
660660
[RT_CLASS_48] = {
661-
.name = RT_STR(RT_PREFIX) "radix_tree node48",
661+
.name = RT_STR(RT_PREFIX) "_radix_tree node48",
662662
.fanout = RT_FANOUT_48,
663663
.allocsize = sizeof(RT_NODE_48) + RT_FANOUT_48 * sizeof(RT_PTR_ALLOC),
664664
},
665665
[RT_CLASS_256] = {
666-
.name = RT_STR(RT_PREFIX) "radix_tree node256",
666+
.name = RT_STR(RT_PREFIX) "_radix_tree node256",
667667
.fanout = RT_FANOUT_256,
668668
.allocsize = sizeof(RT_NODE_256),
669669
},
@@ -1837,7 +1837,7 @@ RT_CREATE(MemoryContext ctx)
18371837
* pfree
18381838
*/
18391839
tree->iter_context = AllocSetContextCreate(ctx,
1840-
RT_STR(RT_PREFIX) "radix_tree iter context",
1840+
RT_STR(RT_PREFIX) "_radix_tree iter context",
18411841
ALLOCSET_SMALL_SIZES);
18421842

18431843
#ifdef RT_SHMEM
@@ -1873,7 +1873,7 @@ RT_CREATE(MemoryContext ctx)
18731873
*/
18741874
if (sizeof(RT_VALUE_TYPE) > sizeof(RT_PTR_ALLOC))
18751875
tree->leaf_context = SlabContextCreate(ctx,
1876-
RT_STR(RT_PREFIX) "radix_tree leaf contex",
1876+
RT_STR(RT_PREFIX) "_radix_tree leaf context",
18771877
RT_SLAB_BLOCK_SIZE(sizeof(RT_VALUE_TYPE)),
18781878
sizeof(RT_VALUE_TYPE));
18791879
#endif /* !RT_VARLEN_VALUE_SIZE */
@@ -2305,7 +2305,7 @@ RT_COPY_ARRAYS_AND_DELETE(uint8 *dst_chunks, RT_PTR_ALLOC * dst_children,
23052305
/*
23062306
* Note: While all node-growing functions are called to perform an insertion
23072307
* when no more space is available, shrinking is not a hard-and-fast requirement.
2308-
* When shrinking nodes, we generally wait until the count is about 3/4* of
2308+
* When shrinking nodes, we generally wait until the count is about 3/4 of
23092309
* the next lower node's fanout. This prevents ping-ponging between different
23102310
* node sizes.
23112311
*
@@ -2556,9 +2556,7 @@ RT_REMOVE_CHILD_4(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR
25562556
}
25572557

25582558
/*
2559-
* Search for the child pointer corresponding to "key" in the given node.
2560-
*
2561-
* Delete the node and return true if the key is found, otherwise return false.
2559+
* Delete the child pointer corresponding to "key" in the given node.
25622560
*/
25632561
static inline void
25642562
RT_NODE_DELETE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot)
@@ -2662,7 +2660,7 @@ RT_DELETE(RT_RADIX_TREE * tree, uint64 key)
26622660
return deleted;
26632661
}
26642662

2665-
#endif /* USE_RT_DELETE */
2663+
#endif /* RT_USE_DELETE */
26662664

26672665
/***************** UTILITY FUNCTIONS *****************/
26682666

@@ -2999,7 +2997,6 @@ RT_DUMP_NODE(RT_NODE * node)
29992997
#undef RT_BEGIN_ITERATE
30002998
#undef RT_ITERATE_NEXT
30012999
#undef RT_END_ITERATE
3002-
#undef RT_USE_DELETE
30033000
#undef RT_DELETE
30043001
#undef RT_MEMORY_USAGE
30053002
#undef RT_DUMP_NODE

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy