v20-0004-Remove-RT_NUM_ENTRIES.patch
application/octet-stream
Filename: v20-0004-Remove-RT_NUM_ENTRIES.patch
Type: application/octet-stream
Part: 9
Patch
Format: format-patch
Series: patch v20-0004
Subject: Remove RT_NUM_ENTRIES
| File | + | − |
|---|---|---|
| src/include/lib/radixtree.h | 0 | 13 |
| src/test/modules/test_radixtree/test_radixtree.c | 9 | 0 |
From 97a647cd9486f58b9186e6dc46fd0afdf474dfd9 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Tue, 17 Jan 2023 16:38:09 +0700
Subject: [PATCH v20 04/13] Remove RT_NUM_ENTRIES
This is not expected to be used everywhere, and is very simple
to implement, so move definition to test module where it is
used extensively.
---
src/include/lib/radixtree.h | 13 -------------
src/test/modules/test_radixtree/test_radixtree.c | 9 +++++++++
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/include/lib/radixtree.h b/src/include/lib/radixtree.h
index 9f8bed09f7..a78079b896 100644
--- a/src/include/lib/radixtree.h
+++ b/src/include/lib/radixtree.h
@@ -63,7 +63,6 @@
* RT_ITERATE_NEXT - Return next key-value pair, if any
* RT_END_ITER - End iteration
* RT_MEMORY_USAGE - Get the memory usage
- * RT_NUM_ENTRIES - Get the number of key-value pairs
*
* RT_CREATE() creates an empty radix tree in the given memory context
* and memory contexts for all kinds of radix tree node under the memory context.
@@ -109,7 +108,6 @@
#define RT_END_ITERATE RT_MAKE_NAME(end_iterate)
#define RT_DELETE RT_MAKE_NAME(delete)
#define RT_MEMORY_USAGE RT_MAKE_NAME(memory_usage)
-#define RT_NUM_ENTRIES RT_MAKE_NAME(num_entries)
#define RT_DUMP RT_MAKE_NAME(dump)
#define RT_DUMP_SEARCH RT_MAKE_NAME(dump_search)
#define RT_STATS RT_MAKE_NAME(stats)
@@ -222,7 +220,6 @@ RT_SCOPE bool RT_ITERATE_NEXT(RT_ITER *iter, uint64 *key_p, uint64 *value_p);
RT_SCOPE void RT_END_ITERATE(RT_ITER *iter);
RT_SCOPE uint64 RT_MEMORY_USAGE(RT_RADIX_TREE *tree);
-RT_SCOPE uint64 RT_NUM_ENTRIES(RT_RADIX_TREE *tree);
#ifdef RT_DEBUG
RT_SCOPE void RT_DUMP(RT_RADIX_TREE *tree);
@@ -1773,15 +1770,6 @@ RT_END_ITERATE(RT_ITER *iter)
pfree(iter);
}
-/*
- * Return the number of keys in the radix tree.
- */
-RT_SCOPE uint64
-RT_NUM_ENTRIES(RT_RADIX_TREE *tree)
-{
- return tree->ctl->num_keys;
-}
-
/*
* Return the statistics of the amount of memory used by the radix tree.
*/
@@ -2187,7 +2175,6 @@ rt_dump(RT_RADIX_TREE *tree)
#undef RT_END_ITERATE
#undef RT_DELETE
#undef RT_MEMORY_USAGE
-#undef RT_NUM_ENTRIES
#undef RT_DUMP
#undef RT_DUMP_SEARCH
#undef RT_STATS
diff --git a/src/test/modules/test_radixtree/test_radixtree.c b/src/test/modules/test_radixtree/test_radixtree.c
index 61d842789d..076173f628 100644
--- a/src/test/modules/test_radixtree/test_radixtree.c
+++ b/src/test/modules/test_radixtree/test_radixtree.c
@@ -109,6 +109,15 @@ static const test_spec test_specs[] = {
#include "lib/radixtree.h"
+/*
+ * Return the number of keys in the radix tree.
+ */
+static uint64
+rt_num_entries(rt_radix_tree *tree)
+{
+ return tree->ctl->num_keys;
+}
+
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(test_radixtree);
--
2.31.1