Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit003c68a

Browse files
committed
Rename rbtree.c functions to use "rbt" prefix not "rb" prefix.
The "rb" prefix is used by Ruby, so that our existing code resultsin name collisions that break plruby. We discussed ways to preventthat by adjusting dynamic linker options, but it seems that at bestwe'd move the pain to other cases. Renaming to avoid the collisionis the only portable fix anyway. Fortunately, our rbtree code isnot (yet?) widely used --- in core, there's only a single usagein 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 wherethere already was a "t" after "rb". The patch could have been madesmaller by only touching linker-visible symbols, but it would haveresulted in oddly inconsistent-looking code. Better to make it looklike "rbt" was the plan all along.Back-patch to v10. The rbtree.c code exists back to 9.5, butrb_iterate() which is the actual immediate source of pain was addedin v10, so it seems like changing the names before that would havemore risk than benefit.Per report from Pavel Raiskup.Discussion:https://postgr.es/m/4738198.8KVIIDhgEB@nb.usersys.redhat.com
1 parent8f623be commit003c68a

File tree

5 files changed

+267
-264
lines changed

5 files changed

+267
-264
lines changed

‎src/backend/access/gin/ginbulk.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/* Combiner function for rbtree.c */
2929
staticvoid
30-
ginCombineData(RBNode*existing,constRBNode*newdata,void*arg)
30+
ginCombineData(RBTNode*existing,constRBTNode*newdata,void*arg)
3131
{
3232
GinEntryAccumulator*eo= (GinEntryAccumulator*)existing;
3333
constGinEntryAccumulator*en= (constGinEntryAccumulator*)newdata;
@@ -69,7 +69,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
6969

7070
/* Comparator function for rbtree.c */
7171
staticint
72-
cmpEntryAccumulator(constRBNode*a,constRBNode*b,void*arg)
72+
cmpEntryAccumulator(constRBTNode*a,constRBTNode*b,void*arg)
7373
{
7474
constGinEntryAccumulator*ea= (constGinEntryAccumulator*)a;
7575
constGinEntryAccumulator*eb= (constGinEntryAccumulator*)b;
@@ -81,15 +81,15 @@ cmpEntryAccumulator(const RBNode *a, const RBNode *b, void *arg)
8181
}
8282

8383
/* Allocator function for rbtree.c */
84-
staticRBNode*
84+
staticRBTNode*
8585
ginAllocEntryAccumulator(void*arg)
8686
{
8787
BuildAccumulator*accum= (BuildAccumulator*)arg;
8888
GinEntryAccumulator*ea;
8989

9090
/*
9191
* Allocate memory by rather big chunks to decrease overhead. We have no
92-
* need to reclaimRBNodes individually, so this costs nothing.
92+
* need to reclaimRBTNodes individually, so this costs nothing.
9393
*/
9494
if (accum->entryallocator==NULL||accum->eas_used >=DEF_NENTRY)
9595
{
@@ -98,11 +98,11 @@ ginAllocEntryAccumulator(void *arg)
9898
accum->eas_used=0;
9999
}
100100

101-
/* Allocate newRBNode from current chunk */
101+
/* Allocate newRBTNode from current chunk */
102102
ea=accum->entryallocator+accum->eas_used;
103103
accum->eas_used++;
104104

105-
return (RBNode*)ea;
105+
return (RBTNode*)ea;
106106
}
107107

108108
void
@@ -112,12 +112,12 @@ ginInitBA(BuildAccumulator *accum)
112112
accum->allocatedMemory=0;
113113
accum->entryallocator=NULL;
114114
accum->eas_used=0;
115-
accum->tree=rb_create(sizeof(GinEntryAccumulator),
116-
cmpEntryAccumulator,
117-
ginCombineData,
118-
ginAllocEntryAccumulator,
119-
NULL,/* no freefunc needed */
120-
(void*)accum);
115+
accum->tree=rbt_create(sizeof(GinEntryAccumulator),
116+
cmpEntryAccumulator,
117+
ginCombineData,
118+
ginAllocEntryAccumulator,
119+
NULL,/* no freefunc needed */
120+
(void*)accum);
121121
}
122122

123123
/*
@@ -163,8 +163,8 @@ ginInsertBAEntry(BuildAccumulator *accum,
163163
/* temporarily set up single-entry itempointer list */
164164
eatmp.list=heapptr;
165165

166-
ea= (GinEntryAccumulator*)rb_insert(accum->tree, (RBNode*)&eatmp,
167-
&isNew);
166+
ea= (GinEntryAccumulator*)rbt_insert(accum->tree, (RBTNode*)&eatmp,
167+
&isNew);
168168

169169
if (isNew)
170170
{
@@ -256,7 +256,7 @@ qsortCompareItemPointers(const void *a, const void *b)
256256
void
257257
ginBeginBAScan(BuildAccumulator*accum)
258258
{
259-
rb_begin_iterate(accum->tree,LeftRightWalk,&accum->tree_walk);
259+
rbt_begin_iterate(accum->tree,LeftRightWalk,&accum->tree_walk);
260260
}
261261

262262
/*
@@ -272,7 +272,7 @@ ginGetBAEntry(BuildAccumulator *accum,
272272
GinEntryAccumulator*entry;
273273
ItemPointerData*list;
274274

275-
entry= (GinEntryAccumulator*)rb_iterate(&accum->tree_walk);
275+
entry= (GinEntryAccumulator*)rbt_iterate(&accum->tree_walk);
276276

277277
if (entry==NULL)
278278
returnNULL;/* no more entries */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp