Skip to content

Commit 8d6e9bc

Browse files
author
Neil Conway
committed
This patch makes some minor style cleanups to contrib/btree_gist: remove
the "extern" keyword from function definitions, reorganize some PG_GETARG_XXX() usage, and similar.
1 parent 34b788d commit 8d6e9bc

File tree

7 files changed

+23
-24
lines changed

7 files changed

+23
-24
lines changed

contrib/btree_gist/btree_bit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ gbt_bit_consistent(PG_FUNCTION_ARGS)
127127
{
128128
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
129129
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
130-
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
130+
void *qtst = (void *) PG_GETARG_POINTER(1);
131131
void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
132132
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
133133
bool retval = FALSE;
@@ -184,9 +184,9 @@ gbt_bit_same(PG_FUNCTION_ARGS)
184184
Datum
185185
gbt_bit_penalty(PG_FUNCTION_ARGS)
186186
{
187-
float *result = (float *) PG_GETARG_POINTER(2);
188187
GISTENTRY *o = (GISTENTRY *) PG_GETARG_POINTER(0);
189188
GISTENTRY *n = (GISTENTRY *) PG_GETARG_POINTER(1);
189+
float *result = (float *) PG_GETARG_POINTER(2);
190190

191191
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, &tinfo));
192192
}

contrib/btree_gist/btree_bytea.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ gbt_bytea_consistent(PG_FUNCTION_ARGS)
9797
{
9898
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
9999
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
100-
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
100+
void *qtst = (void *) PG_GETARG_POINTER(1);
101101
void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
102102
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
103103
bool retval = FALSE;
@@ -146,9 +146,9 @@ gbt_bytea_same(PG_FUNCTION_ARGS)
146146
Datum
147147
gbt_bytea_penalty(PG_FUNCTION_ARGS)
148148
{
149-
float *result = (float *) PG_GETARG_POINTER(2);
150149
GISTENTRY *o = (GISTENTRY *) PG_GETARG_POINTER(0);
151150
GISTENTRY *n = (GISTENTRY *) PG_GETARG_POINTER(1);
151+
float *result = (float *) PG_GETARG_POINTER(2);
152152

153153
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, &tinfo));
154154
}

contrib/btree_gist/btree_numeric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS)
9898

9999
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
100100
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
101-
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
101+
void *qtst = (void *) PG_GETARG_POINTER(1);
102102
void *query = (void *) DatumGetNumeric(PG_GETARG_DATUM(1));
103103
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
104104
bool retval = FALSE;

contrib/btree_gist/btree_text.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ gbt_text_consistent(PG_FUNCTION_ARGS)
124124
{
125125
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
126126
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
127-
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
127+
void *qtst = (void *) PG_GETARG_POINTER(1);
128128
void *query = (void *) DatumGetTextP(PG_GETARG_DATUM(1));
129129
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
130130
bool retval = FALSE;
@@ -144,7 +144,7 @@ gbt_bpchar_consistent(PG_FUNCTION_ARGS)
144144
{
145145
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
146146
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
147-
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
147+
void *qtst = (void *) PG_GETARG_POINTER(1);
148148
void *query = (void *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
149149
void *trim = (void *) DatumGetPointer(DirectFunctionCall1(rtrim1, PointerGetDatum(query)));
150150
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
@@ -197,9 +197,9 @@ gbt_text_same(PG_FUNCTION_ARGS)
197197
Datum
198198
gbt_text_penalty(PG_FUNCTION_ARGS)
199199
{
200-
float *result = (float *) PG_GETARG_POINTER(2);
201200
GISTENTRY *o = (GISTENTRY *) PG_GETARG_POINTER(0);
202201
GISTENTRY *n = (GISTENTRY *) PG_GETARG_POINTER(1);
202+
float *result = (float *) PG_GETARG_POINTER(2);
203203

204204
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, &tinfo));
205205
}

contrib/btree_gist/btree_utils_num.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "btree_utils_num.h"
33
#include "utils/date.h"
44

5-
extern GISTENTRY *
5+
GISTENTRY *
66
gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo)
77
{
88

@@ -61,7 +61,7 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo
6161
** The GiST union method for numerical values
6262
*/
6363

64-
extern void *
64+
void *
6565
gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, const gbtree_ninfo * tinfo)
6666
{
6767
int i,
@@ -99,7 +99,7 @@ gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, const gbtree_ni
9999
** The GiST same method for numerical values
100100
*/
101101

102-
extern bool
102+
bool
103103
gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, const gbtree_ninfo * tinfo)
104104
{
105105

@@ -121,7 +121,7 @@ gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, const gbtree_ninfo * ti
121121
}
122122

123123

124-
extern void
124+
void
125125
gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, const gbtree_ninfo * tinfo)
126126
{
127127

@@ -155,7 +155,7 @@ gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, const gbtree_ninfo * tinfo)
155155
** The GiST consistent method
156156
*/
157157

158-
extern bool
158+
bool
159159
gbt_num_consistent(
160160
const GBT_NUMKEY_R * key,
161161
const void *query,

contrib/btree_gist/btree_utils_var.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ gbt_var_decompress(PG_FUNCTION_ARGS)
2727
}
2828

2929
/* Returns a better readable representaion of variable key ( sets pointer ) */
30-
31-
extern GBT_VARKEY_R
30+
GBT_VARKEY_R
3231
gbt_var_key_readable(const GBT_VARKEY * k)
3332
{
3433

@@ -43,7 +42,7 @@ gbt_var_key_readable(const GBT_VARKEY * k)
4342
}
4443

4544

46-
extern GBT_VARKEY *
45+
GBT_VARKEY *
4746
gbt_var_key_copy(const GBT_VARKEY_R * u, bool force_node)
4847
{
4948

@@ -208,7 +207,7 @@ gbt_var_node_truncate(const GBT_VARKEY * node, int32 length, const gbtree_vinfo
208207

209208

210209

211-
extern void
210+
void
212211
gbt_var_bin_union(Datum *u, GBT_VARKEY * e, const gbtree_vinfo * tinfo)
213212
{
214213

@@ -265,7 +264,7 @@ gbt_var_bin_union(Datum *u, GBT_VARKEY * e, const gbtree_vinfo * tinfo)
265264

266265

267266

268-
extern GISTENTRY *
267+
GISTENTRY *
269268
gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo)
270269
{
271270

@@ -296,7 +295,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo)
296295

297296

298297

299-
extern GBT_VARKEY *
298+
GBT_VARKEY *
300299
gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo * tinfo)
301300
{
302301

@@ -337,7 +336,7 @@ gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo *
337336
}
338337

339338

340-
extern bool
339+
bool
341340
gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo * tinfo)
342341
{
343342

@@ -362,7 +361,7 @@ gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo *
362361

363362

364363

365-
extern float *
364+
float *
366365
gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, const gbtree_vinfo * tinfo)
367366
{
368367

@@ -458,7 +457,7 @@ gbt_vsrt_cmp(const void *a, const void *b)
458457
return (*gbt_vsrt_cmp_tinfo->f_cmp) (ar.lower, br.lower);
459458
}
460459

461-
extern GIST_SPLITVEC *
460+
GIST_SPLITVEC *
462461
gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtree_vinfo * tinfo)
463462
{
464463
OffsetNumber i,
@@ -563,7 +562,7 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtre
563562
/*
564563
* The GiST consistent method
565564
*/
566-
extern bool
565+
bool
567566
gbt_var_consistent(
568567
GBT_VARKEY_R * key,
569568
const void *query,

contrib/rtree_gist/README.rtree_gist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ BENCHMARKS:
5656

5757
cd ./bench
5858
1. createdb TEST
59-
2. psql TEST < ../box.sql
59+
2. psql TEST < ../rtree_gist.sql
6060
3. ./create_test.pl | psql TEST
6161
-- change $NUM - number of rows in test dataset
6262
4. ./bench.pl - perl script to benchmark queries.

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