mirror of
https://github.com/postgres/postgres.git
synced 2026-01-27 21:43:08 +03:00
Mark commented out code as unused
There were many PG_GETARG_* calls, mostly around gin, gist, spgist
code, that were commented out, presumably to indicate that the
argument was unused and to indicate that it wasn't forgotten or
miscounted. But keeping commented-out code updated with refactorings
and style changes is annoying. So this commit changes them to
#ifdef NOT_USED
blocks, which is a style already in use. That way, at least the
indentation and syntax highlighting works correctly, making some of
these blocks much easier to read.
An alternative would be to just delete that code, but there is some
value in making unused arguments explicit, and some of this arguably
serves as example code for index AM APIs.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: David Geier <geidav.pg@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/328e4371-9a4c-4196-9df9-1f23afc900df%40eisentraut.org
This commit is contained in:
@@ -82,9 +82,10 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
|
||||
ArrayType *array = PG_GETARG_ARRAYTYPE_P_COPY(0);
|
||||
int32 *nkeys = (int32 *) PG_GETARG_POINTER(1);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(2);
|
||||
|
||||
/* bool **pmatch = (bool **) PG_GETARG_POINTER(3); */
|
||||
/* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
|
||||
#ifdef NOT_USED
|
||||
bool **pmatch = (bool **) PG_GETARG_POINTER(3);
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
#endif
|
||||
bool **nullFlags = (bool **) PG_GETARG_POINTER(5);
|
||||
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
|
||||
int16 elmlen;
|
||||
@@ -143,14 +144,17 @@ ginarrayconsistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bool *check = (bool *) PG_GETARG_POINTER(0);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
|
||||
/* ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); */
|
||||
#ifdef NOT_USED
|
||||
ArrayType *query = PG_GETARG_ARRAYTYPE_P(2);
|
||||
#endif
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
|
||||
/* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
|
||||
#ifdef NOT_USED
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(5);
|
||||
|
||||
/* Datum *queryKeys = (Datum *) PG_GETARG_POINTER(6); */
|
||||
#ifdef NOT_USED
|
||||
Datum *queryKeys = (Datum *) PG_GETARG_POINTER(6);
|
||||
#endif
|
||||
bool *nullFlags = (bool *) PG_GETARG_POINTER(7);
|
||||
bool res;
|
||||
int32 i;
|
||||
@@ -227,12 +231,14 @@ ginarraytriconsistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
|
||||
/* ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); */
|
||||
#ifdef NOT_USED
|
||||
ArrayType *query = PG_GETARG_ARRAYTYPE_P(2);
|
||||
#endif
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
|
||||
/* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
|
||||
/* Datum *queryKeys = (Datum *) PG_GETARG_POINTER(5); */
|
||||
#ifdef NOT_USED
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
Datum *queryKeys = (Datum *) PG_GETARG_POINTER(5);
|
||||
#endif
|
||||
bool *nullFlags = (bool *) PG_GETARG_POINTER(6);
|
||||
GinTernaryValue res;
|
||||
int32 i;
|
||||
|
||||
@@ -115,8 +115,9 @@ gist_box_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
BOX *query = PG_GETARG_BOX_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
@@ -1064,8 +1065,9 @@ gist_poly_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
POLYGON *query = PG_GETARG_POLYGON_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
bool result;
|
||||
|
||||
@@ -1132,8 +1134,9 @@ gist_circle_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
CIRCLE *query = PG_GETARG_CIRCLE_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
BOX bbox;
|
||||
bool result;
|
||||
@@ -1502,9 +1505,10 @@ gist_box_distance(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
Datum query = PG_GETARG_DATUM(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
/* bool *recheck = (bool *) PG_GETARG_POINTER(4); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
#endif
|
||||
float8 distance;
|
||||
|
||||
distance = gist_bbox_distance(entry, query, strategy);
|
||||
@@ -1528,8 +1532,9 @@ gist_circle_distance(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
Datum query = PG_GETARG_DATUM(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
float8 distance;
|
||||
|
||||
@@ -1545,8 +1550,9 @@ gist_poly_distance(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
Datum query = PG_GETARG_DATUM(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
float8 distance;
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
Datum
|
||||
spg_kd_config(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
|
||||
#ifdef NOT_USED
|
||||
spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0);
|
||||
#endif
|
||||
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
|
||||
|
||||
cfg->prefixType = FLOAT8OID;
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
Datum
|
||||
spg_quad_config(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
|
||||
#ifdef NOT_USED
|
||||
spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0);
|
||||
#endif
|
||||
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
|
||||
|
||||
cfg->prefixType = POINTOID;
|
||||
|
||||
@@ -95,7 +95,9 @@ typedef struct spgNodePtr
|
||||
Datum
|
||||
spg_text_config(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
|
||||
#ifdef NOT_USED
|
||||
spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0);
|
||||
#endif
|
||||
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
|
||||
|
||||
cfg->prefixType = TEXTOID;
|
||||
|
||||
@@ -396,7 +396,9 @@ datum_image_hash(Datum value, bool typByVal, int typLen)
|
||||
Datum
|
||||
btequalimage(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* Oid opcintype = PG_GETARG_OID(0); */
|
||||
#ifdef NOT_USED
|
||||
Oid opcintype = PG_GETARG_OID(0);
|
||||
#endif
|
||||
|
||||
PG_RETURN_BOOL(true);
|
||||
}
|
||||
|
||||
@@ -931,8 +931,9 @@ gin_consistent_jsonb(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bool *check = (bool *) PG_GETARG_POINTER(0);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
|
||||
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
|
||||
#ifdef NOT_USED
|
||||
Jsonb *query = PG_GETARG_JSONB_P(2);
|
||||
#endif
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
@@ -1014,8 +1015,9 @@ gin_triconsistent_jsonb(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
|
||||
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
|
||||
#ifdef NOT_USED
|
||||
Jsonb *query = PG_GETARG_JSONB_P(2);
|
||||
#endif
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
GinTernaryValue res = GIN_MAYBE;
|
||||
@@ -1220,8 +1222,9 @@ gin_consistent_jsonb_path(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bool *check = (bool *) PG_GETARG_POINTER(0);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
|
||||
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
|
||||
#ifdef NOT_USED
|
||||
Jsonb *query = PG_GETARG_JSONB_P(2);
|
||||
#endif
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(5);
|
||||
@@ -1271,8 +1274,9 @@ gin_triconsistent_jsonb_path(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
|
||||
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
|
||||
#ifdef NOT_USED
|
||||
Jsonb *query = PG_GETARG_JSONB_P(2);
|
||||
#endif
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
GinTernaryValue res = GIN_MAYBE;
|
||||
|
||||
@@ -117,8 +117,9 @@ inet_gist_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *ent = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
inet *query = PG_GETARG_INET_PP(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
GistInetKey *key = DatumGetInetKeyP(ent->key);
|
||||
int minbits,
|
||||
|
||||
@@ -50,7 +50,9 @@ static int inet_spg_consistent_bitmap(const inet *prefix, int nkeys,
|
||||
Datum
|
||||
inet_spg_config(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
|
||||
#ifdef NOT_USED
|
||||
spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0);
|
||||
#endif
|
||||
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
|
||||
|
||||
cfg->prefixType = CIDROID;
|
||||
|
||||
@@ -59,7 +59,9 @@ static int adjacent_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *arg,
|
||||
Datum
|
||||
spg_range_quad_config(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
|
||||
#ifdef NOT_USED
|
||||
spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0);
|
||||
#endif
|
||||
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
|
||||
|
||||
cfg->prefixType = ANYRANGEOID;
|
||||
|
||||
@@ -95,12 +95,14 @@ gin_extract_tsquery(PG_FUNCTION_ARGS)
|
||||
{
|
||||
TSQuery query = PG_GETARG_TSQUERY(0);
|
||||
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
|
||||
|
||||
/* StrategyNumber strategy = PG_GETARG_UINT16(2); */
|
||||
#ifdef NOT_USED
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(2);
|
||||
#endif
|
||||
bool **ptr_partialmatch = (bool **) PG_GETARG_POINTER(3);
|
||||
Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
|
||||
|
||||
/* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */
|
||||
#ifdef NOT_USED
|
||||
bool **nullFlags = (bool **) PG_GETARG_POINTER(5);
|
||||
#endif
|
||||
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
|
||||
Datum *entries = NULL;
|
||||
|
||||
@@ -214,11 +216,13 @@ Datum
|
||||
gin_tsquery_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bool *check = (bool *) PG_GETARG_POINTER(0);
|
||||
|
||||
/* StrategyNumber strategy = PG_GETARG_UINT16(1); */
|
||||
#ifdef NOT_USED
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
#endif
|
||||
TSQuery query = PG_GETARG_TSQUERY(2);
|
||||
|
||||
/* int32 nkeys = PG_GETARG_INT32(3); */
|
||||
#ifdef NOT_USED
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
#endif
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(5);
|
||||
bool res = false;
|
||||
@@ -263,11 +267,13 @@ Datum
|
||||
gin_tsquery_triconsistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
|
||||
|
||||
/* StrategyNumber strategy = PG_GETARG_UINT16(1); */
|
||||
#ifdef NOT_USED
|
||||
StrategyNumber strategy = PG_GETARG_UINT16(1);
|
||||
#endif
|
||||
TSQuery query = PG_GETARG_TSQUERY(2);
|
||||
|
||||
/* int32 nkeys = PG_GETARG_INT32(3); */
|
||||
#ifdef NOT_USED
|
||||
int32 nkeys = PG_GETARG_INT32(3);
|
||||
#endif
|
||||
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
|
||||
GinTernaryValue res = GIN_FALSE;
|
||||
|
||||
|
||||
@@ -326,9 +326,10 @@ gtsvector_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
TSQuery query = PG_GETARG_TSQUERY(1);
|
||||
|
||||
/* StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); */
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
SignTSVector *key = (SignTSVector *) DatumGetPointer(entry->key);
|
||||
|
||||
|
||||
@@ -55,8 +55,9 @@ gtsquery_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
TSQuery query = PG_GETARG_TSQUERY(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
#ifdef NOT_USED
|
||||
Oid subtype = PG_GETARG_OID(3);
|
||||
#endif
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
TSQuerySign key = DatumGetTSQuerySign(entry->key);
|
||||
TSQuerySign sq = makeTSQuerySign(query);
|
||||
|
||||
@@ -2267,7 +2267,9 @@ varstr_abbrev_abort(int memtupcount, SortSupport ssup)
|
||||
Datum
|
||||
btvarstrequalimage(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* Oid opcintype = PG_GETARG_OID(0); */
|
||||
#ifdef NOT_USED
|
||||
Oid opcintype = PG_GETARG_OID(0);
|
||||
#endif
|
||||
Oid collid = PG_GET_COLLATION();
|
||||
pg_locale_t locale;
|
||||
|
||||
|
||||
@@ -33,7 +33,9 @@ PG_FUNCTION_INFO_V1(spgist_name_config);
|
||||
Datum
|
||||
spgist_name_config(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
|
||||
#ifdef NOT_USED
|
||||
spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0);
|
||||
#endif
|
||||
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
|
||||
|
||||
cfg->prefixType = TEXTOID;
|
||||
|
||||
Reference in New Issue
Block a user