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

Commitf8467f7

Browse files
committed
Prevent to use magic constants
Use macroses for definition amstrategies/amsupport fields instead ofhardcoded values.Author: Nikolay Shaplov with addition for contrib/bloom
1 parente2c79e1 commitf8467f7

File tree

8 files changed

+11
-9
lines changed

8 files changed

+11
-9
lines changed

‎contrib/bloom/blutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ blhandler(PG_FUNCTION_ARGS)
7373
{
7474
IndexAmRoutine*amroutine=makeNode(IndexAmRoutine);
7575

76-
amroutine->amstrategies=1;
77-
amroutine->amsupport=1;
76+
amroutine->amstrategies=BLOOM_NSTRATEGIES;
77+
amroutine->amsupport=BLOOM_NPROC;
7878
amroutine->amcanorder= false;
7979
amroutine->amcanorderbyop= false;
8080
amroutine->amcanbackward= false;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ginhandler(PG_FUNCTION_ARGS)
3535
IndexAmRoutine*amroutine=makeNode(IndexAmRoutine);
3636

3737
amroutine->amstrategies=0;
38-
amroutine->amsupport=6;
38+
amroutine->amsupport=GINNProcs;
3939
amroutine->amcanorder= false;
4040
amroutine->amcanorderbyop= false;
4141
amroutine->amcanbackward= false;

‎src/backend/access/gist/gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ gisthandler(PG_FUNCTION_ARGS)
5757
IndexAmRoutine*amroutine=makeNode(IndexAmRoutine);
5858

5959
amroutine->amstrategies=0;
60-
amroutine->amsupport=9;
60+
amroutine->amsupport=GISTNProcs;
6161
amroutine->amcanorder= false;
6262
amroutine->amcanorderbyop= true;
6363
amroutine->amcanbackward= false;

‎src/backend/access/hash/hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ hashhandler(PG_FUNCTION_ARGS)
5151
{
5252
IndexAmRoutine*amroutine=makeNode(IndexAmRoutine);
5353

54-
amroutine->amstrategies=1;
55-
amroutine->amsupport=1;
54+
amroutine->amstrategies=HTMaxStrategyNumber;
55+
amroutine->amsupport=HASHNProcs;
5656
amroutine->amcanorder= false;
5757
amroutine->amcanorderbyop= false;
5858
amroutine->amcanbackward= true;

‎src/backend/access/nbtree/nbtree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ bthandler(PG_FUNCTION_ARGS)
8484
{
8585
IndexAmRoutine*amroutine=makeNode(IndexAmRoutine);
8686

87-
amroutine->amstrategies=5;
88-
amroutine->amsupport=2;
87+
amroutine->amstrategies=BTMaxStrategyNumber;
88+
amroutine->amsupport=BTNProcs;
8989
amroutine->amcanorder= true;
9090
amroutine->amcanorderbyop= false;
9191
amroutine->amcanbackward= true;

‎src/backend/access/spgist/spgutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spghandler(PG_FUNCTION_ARGS)
3636
IndexAmRoutine*amroutine=makeNode(IndexAmRoutine);
3737

3838
amroutine->amstrategies=0;
39-
amroutine->amsupport=5;
39+
amroutine->amsupport=SPGISTNProc;
4040
amroutine->amcanorder= false;
4141
amroutine->amcanorderbyop= false;
4242
amroutine->amcanbackward= false;

‎src/include/access/hash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ typedef HashMetaPageData *HashMetaPage;
239239
*Since we only have one such proc in amproc, it's number 1.
240240
*/
241241
#defineHASHPROC1
242+
#defineHASHNProcs1
242243

243244

244245
/* public routines */

‎src/include/access/nbtree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ typedef struct xl_btree_newroot
454454

455455
#defineBTORDER_PROC1
456456
#defineBTSORTSUPPORT_PROC2
457+
#defineBTNProcs2
457458

458459
/*
459460
*We need to be able to tell the difference between read and write

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp