summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginbulk.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-11-06 13:25:24 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-11-06 13:25:24 -0500
commit003c68a3b45d0d135b874acfe04cf3fb79a6f172 (patch)
treeeae0a074ebf71ec57eb651dcd9f4578b37de1e36 /src/backend/access/gin/ginbulk.c
parent8f623bedfb4fee5a125b25720e5451379cf26ff9 (diff)
downloadpostgresql-003c68a3b45d0d135b874acfe04cf3fb79a6f172.tar.gz
Rename rbtree.c functions to use "rbt" prefix not "rb" prefix.
The "rb" prefix is used by Ruby, so that our existing code results in name collisions that break plruby. We discussed ways to prevent that by adjusting dynamic linker options, but it seems that at best we'd move the pain to other cases. Renaming to avoid the collision is the only portable fix anyway. Fortunately, our rbtree code is not (yet?) widely used --- in core, there's only a single usage in GIN --- so it seems likely that we can get away with a rename. I chose to do this basically as s/rb/rbt/g, except for places where there already was a "t" after "rb". The patch could have been made smaller by only touching linker-visible symbols, but it would have resulted in oddly inconsistent-looking code. Better to make it look like "rbt" was the plan all along. Back-patch to v10. The rbtree.c code exists back to 9.5, but rb_iterate() which is the actual immediate source of pain was added in v10, so it seems like changing the names before that would have more risk than benefit. Per report from Pavel Raiskup. Discussion: https://postgr.es/m/4738198.8KVIIDhgEB@nb.usersys.redhat.com
Diffstat (limited to 'src/backend/access/gin/ginbulk.c')
-rw-r--r--src/backend/access/gin/ginbulk.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c
index 989c2a0c02..f2fbe6fa3f 100644
--- a/src/backend/access/gin/ginbulk.c
+++ b/src/backend/access/gin/ginbulk.c
@@ -27,7 +27,7 @@
/* Combiner function for rbtree.c */
static void
-ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
+ginCombineData(RBTNode *existing, const RBTNode *newdata, void *arg)
{
GinEntryAccumulator *eo = (GinEntryAccumulator *) existing;
const GinEntryAccumulator *en = (const GinEntryAccumulator *) newdata;
@@ -69,7 +69,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
/* Comparator function for rbtree.c */
static int
-cmpEntryAccumulator(const RBNode *a, const RBNode *b, void *arg)
+cmpEntryAccumulator(const RBTNode *a, const RBTNode *b, void *arg)
{
const GinEntryAccumulator *ea = (const GinEntryAccumulator *) a;
const GinEntryAccumulator *eb = (const GinEntryAccumulator *) b;
@@ -81,7 +81,7 @@ cmpEntryAccumulator(const RBNode *a, const RBNode *b, void *arg)
}
/* Allocator function for rbtree.c */
-static RBNode *
+static RBTNode *
ginAllocEntryAccumulator(void *arg)
{
BuildAccumulator *accum = (BuildAccumulator *) arg;
@@ -89,7 +89,7 @@ ginAllocEntryAccumulator(void *arg)
/*
* Allocate memory by rather big chunks to decrease overhead. We have no
- * need to reclaim RBNodes individually, so this costs nothing.
+ * need to reclaim RBTNodes individually, so this costs nothing.
*/
if (accum->entryallocator == NULL || accum->eas_used >= DEF_NENTRY)
{
@@ -98,11 +98,11 @@ ginAllocEntryAccumulator(void *arg)
accum->eas_used = 0;
}
- /* Allocate new RBNode from current chunk */
+ /* Allocate new RBTNode from current chunk */
ea = accum->entryallocator + accum->eas_used;
accum->eas_used++;
- return (RBNode *) ea;
+ return (RBTNode *) ea;
}
void
@@ -112,12 +112,12 @@ ginInitBA(BuildAccumulator *accum)
accum->allocatedMemory = 0;
accum->entryallocator = NULL;
accum->eas_used = 0;
- accum->tree = rb_create(sizeof(GinEntryAccumulator),
- cmpEntryAccumulator,
- ginCombineData,
- ginAllocEntryAccumulator,
- NULL, /* no freefunc needed */
- (void *) accum);
+ accum->tree = rbt_create(sizeof(GinEntryAccumulator),
+ cmpEntryAccumulator,
+ ginCombineData,
+ ginAllocEntryAccumulator,
+ NULL, /* no freefunc needed */
+ (void *) accum);
}
/*
@@ -163,8 +163,8 @@ ginInsertBAEntry(BuildAccumulator *accum,
/* temporarily set up single-entry itempointer list */
eatmp.list = heapptr;
- ea = (GinEntryAccumulator *) rb_insert(accum->tree, (RBNode *) &eatmp,
- &isNew);
+ ea = (GinEntryAccumulator *) rbt_insert(accum->tree, (RBTNode *) &eatmp,
+ &isNew);
if (isNew)
{
@@ -256,7 +256,7 @@ qsortCompareItemPointers(const void *a, const void *b)
void
ginBeginBAScan(BuildAccumulator *accum)
{
- rb_begin_iterate(accum->tree, LeftRightWalk, &accum->tree_walk);
+ rbt_begin_iterate(accum->tree, LeftRightWalk, &accum->tree_walk);
}
/*
@@ -272,7 +272,7 @@ ginGetBAEntry(BuildAccumulator *accum,
GinEntryAccumulator *entry;
ItemPointerData *list;
- entry = (GinEntryAccumulator *) rb_iterate(&accum->tree_walk);
+ entry = (GinEntryAccumulator *) rbt_iterate(&accum->tree_walk);
if (entry == NULL)
return NULL; /* no more entries */