mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
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.
This commit is contained in:
parent
34b788d674
commit
8d6e9bca37
@ -127,7 +127,7 @@ gbt_bit_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
|
||||
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
|
||||
void *qtst = (void *) PG_GETARG_POINTER(1);
|
||||
void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
bool retval = FALSE;
|
||||
@ -184,9 +184,9 @@ gbt_bit_same(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
gbt_bit_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
GISTENTRY *o = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GISTENTRY *n = (GISTENTRY *) PG_GETARG_POINTER(1);
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, &tinfo));
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ gbt_bytea_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
|
||||
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
|
||||
void *qtst = (void *) PG_GETARG_POINTER(1);
|
||||
void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
bool retval = FALSE;
|
||||
@ -146,9 +146,9 @@ gbt_bytea_same(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
gbt_bytea_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
GISTENTRY *o = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GISTENTRY *n = (GISTENTRY *) PG_GETARG_POINTER(1);
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, &tinfo));
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS)
|
||||
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
|
||||
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
|
||||
void *qtst = (void *) PG_GETARG_POINTER(1);
|
||||
void *query = (void *) DatumGetNumeric(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
bool retval = FALSE;
|
||||
|
@ -124,7 +124,7 @@ gbt_text_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
|
||||
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
|
||||
void *qtst = (void *) PG_GETARG_POINTER(1);
|
||||
void *query = (void *) DatumGetTextP(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
bool retval = FALSE;
|
||||
@ -144,7 +144,7 @@ gbt_bpchar_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
|
||||
void *qtst = (void *) DatumGetPointer(PG_GETARG_DATUM(1));
|
||||
void *qtst = (void *) PG_GETARG_POINTER(1);
|
||||
void *query = (void *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
|
||||
void *trim = (void *) DatumGetPointer(DirectFunctionCall1(rtrim1, PointerGetDatum(query)));
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
@ -197,9 +197,9 @@ gbt_text_same(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
gbt_text_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
GISTENTRY *o = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GISTENTRY *n = (GISTENTRY *) PG_GETARG_POINTER(1);
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, &tinfo));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "btree_utils_num.h"
|
||||
#include "utils/date.h"
|
||||
|
||||
extern GISTENTRY *
|
||||
GISTENTRY *
|
||||
gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo)
|
||||
{
|
||||
|
||||
@ -61,7 +61,7 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo
|
||||
** The GiST union method for numerical values
|
||||
*/
|
||||
|
||||
extern void *
|
||||
void *
|
||||
gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, const gbtree_ninfo * tinfo)
|
||||
{
|
||||
int i,
|
||||
@ -99,7 +99,7 @@ gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, const gbtree_ni
|
||||
** The GiST same method for numerical values
|
||||
*/
|
||||
|
||||
extern bool
|
||||
bool
|
||||
gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, const gbtree_ninfo * tinfo)
|
||||
{
|
||||
|
||||
@ -121,7 +121,7 @@ gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, const gbtree_ninfo * ti
|
||||
}
|
||||
|
||||
|
||||
extern void
|
||||
void
|
||||
gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, const gbtree_ninfo * tinfo)
|
||||
{
|
||||
|
||||
@ -155,7 +155,7 @@ gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, const gbtree_ninfo * tinfo)
|
||||
** The GiST consistent method
|
||||
*/
|
||||
|
||||
extern bool
|
||||
bool
|
||||
gbt_num_consistent(
|
||||
const GBT_NUMKEY_R * key,
|
||||
const void *query,
|
||||
|
@ -27,8 +27,7 @@ gbt_var_decompress(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
/* Returns a better readable representaion of variable key ( sets pointer ) */
|
||||
|
||||
extern GBT_VARKEY_R
|
||||
GBT_VARKEY_R
|
||||
gbt_var_key_readable(const GBT_VARKEY * k)
|
||||
{
|
||||
|
||||
@ -43,7 +42,7 @@ gbt_var_key_readable(const GBT_VARKEY * k)
|
||||
}
|
||||
|
||||
|
||||
extern GBT_VARKEY *
|
||||
GBT_VARKEY *
|
||||
gbt_var_key_copy(const GBT_VARKEY_R * u, bool force_node)
|
||||
{
|
||||
|
||||
@ -208,7 +207,7 @@ gbt_var_node_truncate(const GBT_VARKEY * node, int32 length, const gbtree_vinfo
|
||||
|
||||
|
||||
|
||||
extern void
|
||||
void
|
||||
gbt_var_bin_union(Datum *u, GBT_VARKEY * e, const gbtree_vinfo * tinfo)
|
||||
{
|
||||
|
||||
@ -265,7 +264,7 @@ gbt_var_bin_union(Datum *u, GBT_VARKEY * e, const gbtree_vinfo * tinfo)
|
||||
|
||||
|
||||
|
||||
extern GISTENTRY *
|
||||
GISTENTRY *
|
||||
gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo)
|
||||
{
|
||||
|
||||
@ -296,7 +295,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo)
|
||||
|
||||
|
||||
|
||||
extern GBT_VARKEY *
|
||||
GBT_VARKEY *
|
||||
gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo * tinfo)
|
||||
{
|
||||
|
||||
@ -337,7 +336,7 @@ gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo *
|
||||
}
|
||||
|
||||
|
||||
extern bool
|
||||
bool
|
||||
gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo * tinfo)
|
||||
{
|
||||
|
||||
@ -362,7 +361,7 @@ gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo *
|
||||
|
||||
|
||||
|
||||
extern float *
|
||||
float *
|
||||
gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, const gbtree_vinfo * tinfo)
|
||||
{
|
||||
|
||||
@ -458,7 +457,7 @@ gbt_vsrt_cmp(const void *a, const void *b)
|
||||
return (*gbt_vsrt_cmp_tinfo->f_cmp) (ar.lower, br.lower);
|
||||
}
|
||||
|
||||
extern GIST_SPLITVEC *
|
||||
GIST_SPLITVEC *
|
||||
gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtree_vinfo * tinfo)
|
||||
{
|
||||
OffsetNumber i,
|
||||
@ -563,7 +562,7 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtre
|
||||
/*
|
||||
* The GiST consistent method
|
||||
*/
|
||||
extern bool
|
||||
bool
|
||||
gbt_var_consistent(
|
||||
GBT_VARKEY_R * key,
|
||||
const void *query,
|
||||
|
@ -56,7 +56,7 @@ BENCHMARKS:
|
||||
|
||||
cd ./bench
|
||||
1. createdb TEST
|
||||
2. psql TEST < ../box.sql
|
||||
2. psql TEST < ../rtree_gist.sql
|
||||
3. ./create_test.pl | psql TEST
|
||||
-- change $NUM - number of rows in test dataset
|
||||
4. ./bench.pl - perl script to benchmark queries.
|
||||
|
Loading…
Reference in New Issue
Block a user