Skip to content

Commit 65a9138

Browse files
committed
Use CallerFInfoFunctionCall with btree_gist for varlena types
Follow up to commit 393bb504d7 which did this for numeric types.
1 parent 4b1c68d commit 65a9138

File tree

6 files changed

+100
-97
lines changed

6 files changed

+100
-97
lines changed

contrib/btree_gist/btree_bit.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,47 @@ PG_FUNCTION_INFO_V1(gbt_bit_same);
2424
/* define for comparison */
2525

2626
static bool
27-
gbt_bitgt(const void *a, const void *b, Oid collation)
27+
gbt_bitgt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
2828
{
2929
return DatumGetBool(DirectFunctionCall2(bitgt,
3030
PointerGetDatum(a),
3131
PointerGetDatum(b)));
3232
}
3333

3434
static bool
35-
gbt_bitge(const void *a, const void *b, Oid collation)
35+
gbt_bitge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
3636
{
3737
return DatumGetBool(DirectFunctionCall2(bitge,
3838
PointerGetDatum(a),
3939
PointerGetDatum(b)));
4040
}
4141

4242
static bool
43-
gbt_biteq(const void *a, const void *b, Oid collation)
43+
gbt_biteq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
4444
{
4545
return DatumGetBool(DirectFunctionCall2(biteq,
4646
PointerGetDatum(a),
4747
PointerGetDatum(b)));
4848
}
4949

5050
static bool
51-
gbt_bitle(const void *a, const void *b, Oid collation)
51+
gbt_bitle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
5252
{
5353
return DatumGetBool(DirectFunctionCall2(bitle,
5454
PointerGetDatum(a),
5555
PointerGetDatum(b)));
5656
}
5757

5858
static bool
59-
gbt_bitlt(const void *a, const void *b, Oid collation)
59+
gbt_bitlt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
6060
{
6161
return DatumGetBool(DirectFunctionCall2(bitlt,
6262
PointerGetDatum(a),
6363
PointerGetDatum(b)));
6464
}
6565

6666
static int32
67-
gbt_bitcmp(const void *a, const void *b, Oid collation)
67+
gbt_bitcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
6868
{
6969
return DatumGetInt32(DirectFunctionCall2(byteacmp,
7070
PointerGetDatum(a),
@@ -92,7 +92,7 @@ gbt_bit_xfrm(bytea *leaf)
9292

9393

9494
static GBT_VARKEY *
95-
gbt_bit_l2n(GBT_VARKEY *leaf)
95+
gbt_bit_l2n(GBT_VARKEY *leaf, FmgrInfo *flinfo)
9696
{
9797
GBT_VARKEY *out = leaf;
9898
GBT_VARKEY_R r = gbt_var_key_readable(leaf);
@@ -152,13 +152,13 @@ gbt_bit_consistent(PG_FUNCTION_ARGS)
152152

153153
if (GIST_LEAF(entry))
154154
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
155-
TRUE, &tinfo);
155+
TRUE, &tinfo, fcinfo->flinfo);
156156
else
157157
{
158158
bytea *q = gbt_bit_xfrm((bytea *) query);
159159

160160
retval = gbt_var_consistent(&r, q, strategy, PG_GET_COLLATION(),
161-
FALSE, &tinfo);
161+
FALSE, &tinfo, fcinfo->flinfo);
162162
}
163163
PG_RETURN_BOOL(retval);
164164
}
@@ -172,7 +172,7 @@ gbt_bit_union(PG_FUNCTION_ARGS)
172172
int32 *size = (int *) PG_GETARG_POINTER(1);
173173

174174
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
175-
&tinfo));
175+
&tinfo, fcinfo->flinfo));
176176
}
177177

178178

@@ -183,7 +183,7 @@ gbt_bit_picksplit(PG_FUNCTION_ARGS)
183183
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
184184

185185
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
186-
&tinfo);
186+
&tinfo, fcinfo->flinfo);
187187
PG_RETURN_POINTER(v);
188188
}
189189

@@ -194,7 +194,7 @@ gbt_bit_same(PG_FUNCTION_ARGS)
194194
Datum d2 = PG_GETARG_DATUM(1);
195195
bool *result = (bool *) PG_GETARG_POINTER(2);
196196

197-
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
197+
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
198198
PG_RETURN_POINTER(result);
199199
}
200200

@@ -207,5 +207,5 @@ gbt_bit_penalty(PG_FUNCTION_ARGS)
207207
float *result = (float *) PG_GETARG_POINTER(2);
208208

209209
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
210-
&tinfo));
210+
&tinfo, fcinfo->flinfo));
211211
}

contrib/btree_gist/btree_bytea.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,47 @@ PG_FUNCTION_INFO_V1(gbt_bytea_same);
2323
/* define for comparison */
2424

2525
static bool
26-
gbt_byteagt(const void *a, const void *b, Oid collation)
26+
gbt_byteagt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
2727
{
2828
return DatumGetBool(DirectFunctionCall2(byteagt,
2929
PointerGetDatum(a),
3030
PointerGetDatum(b)));
3131
}
3232

3333
static bool
34-
gbt_byteage(const void *a, const void *b, Oid collation)
34+
gbt_byteage(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
3535
{
3636
return DatumGetBool(DirectFunctionCall2(byteage,
3737
PointerGetDatum(a),
3838
PointerGetDatum(b)));
3939
}
4040

4141
static bool
42-
gbt_byteaeq(const void *a, const void *b, Oid collation)
42+
gbt_byteaeq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
4343
{
4444
return DatumGetBool(DirectFunctionCall2(byteaeq,
4545
PointerGetDatum(a),
4646
PointerGetDatum(b)));
4747
}
4848

4949
static bool
50-
gbt_byteale(const void *a, const void *b, Oid collation)
50+
gbt_byteale(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
5151
{
5252
return DatumGetBool(DirectFunctionCall2(byteale,
5353
PointerGetDatum(a),
5454
PointerGetDatum(b)));
5555
}
5656

5757
static bool
58-
gbt_bytealt(const void *a, const void *b, Oid collation)
58+
gbt_bytealt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
5959
{
6060
return DatumGetBool(DirectFunctionCall2(bytealt,
6161
PointerGetDatum(a),
6262
PointerGetDatum(b)));
6363
}
6464

6565
static int32
66-
gbt_byteacmp(const void *a, const void *b, Oid collation)
66+
gbt_byteacmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
6767
{
6868
return DatumGetInt32(DirectFunctionCall2(byteacmp,
6969
PointerGetDatum(a),
@@ -118,7 +118,7 @@ gbt_bytea_consistent(PG_FUNCTION_ARGS)
118118
*recheck = false;
119119

120120
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
121-
GIST_LEAF(entry), &tinfo);
121+
GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
122122
PG_RETURN_BOOL(retval);
123123
}
124124

@@ -131,7 +131,7 @@ gbt_bytea_union(PG_FUNCTION_ARGS)
131131
int32 *size = (int *) PG_GETARG_POINTER(1);
132132

133133
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
134-
&tinfo));
134+
&tinfo, fcinfo->flinfo));
135135
}
136136

137137

@@ -142,7 +142,7 @@ gbt_bytea_picksplit(PG_FUNCTION_ARGS)
142142
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
143143

144144
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
145-
&tinfo);
145+
&tinfo, fcinfo->flinfo);
146146
PG_RETURN_POINTER(v);
147147
}
148148

@@ -153,7 +153,7 @@ gbt_bytea_same(PG_FUNCTION_ARGS)
153153
Datum d2 = PG_GETARG_DATUM(1);
154154
bool *result = (bool *) PG_GETARG_POINTER(2);
155155

156-
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
156+
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
157157
PG_RETURN_POINTER(result);
158158
}
159159

@@ -166,5 +166,5 @@ gbt_bytea_penalty(PG_FUNCTION_ARGS)
166166
float *result = (float *) PG_GETARG_POINTER(2);
167167

168168
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
169-
&tinfo));
169+
&tinfo, fcinfo->flinfo));
170170
}

contrib/btree_gist/btree_numeric.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,47 @@ PG_FUNCTION_INFO_V1(gbt_numeric_same);
2727
/* define for comparison */
2828

2929
static bool
30-
gbt_numeric_gt(const void *a, const void *b, Oid collation)
30+
gbt_numeric_gt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
3131
{
3232
return DatumGetBool(DirectFunctionCall2(numeric_gt,
3333
PointerGetDatum(a),
3434
PointerGetDatum(b)));
3535
}
3636

3737
static bool
38-
gbt_numeric_ge(const void *a, const void *b, Oid collation)
38+
gbt_numeric_ge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
3939
{
4040
return DatumGetBool(DirectFunctionCall2(numeric_ge,
4141
PointerGetDatum(a),
4242
PointerGetDatum(b)));
4343
}
4444

4545
static bool
46-
gbt_numeric_eq(const void *a, const void *b, Oid collation)
46+
gbt_numeric_eq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
4747
{
4848
return DatumGetBool(DirectFunctionCall2(numeric_eq,
4949
PointerGetDatum(a),
5050
PointerGetDatum(b)));
5151
}
5252

5353
static bool
54-
gbt_numeric_le(const void *a, const void *b, Oid collation)
54+
gbt_numeric_le(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
5555
{
5656
return DatumGetBool(DirectFunctionCall2(numeric_le,
5757
PointerGetDatum(a),
5858
PointerGetDatum(b)));
5959
}
6060

6161
static bool
62-
gbt_numeric_lt(const void *a, const void *b, Oid collation)
62+
gbt_numeric_lt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
6363
{
6464
return DatumGetBool(DirectFunctionCall2(numeric_lt,
6565
PointerGetDatum(a),
6666
PointerGetDatum(b)));
6767
}
6868

6969
static int32
70-
gbt_numeric_cmp(const void *a, const void *b, Oid collation)
70+
gbt_numeric_cmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
7171
{
7272
return DatumGetInt32(DirectFunctionCall2(numeric_cmp,
7373
PointerGetDatum(a),
@@ -122,7 +122,7 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS)
122122
*recheck = false;
123123

124124
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
125-
GIST_LEAF(entry), &tinfo);
125+
GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
126126
PG_RETURN_BOOL(retval);
127127
}
128128

@@ -135,7 +135,7 @@ gbt_numeric_union(PG_FUNCTION_ARGS)
135135
int32 *size = (int *) PG_GETARG_POINTER(1);
136136

137137
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
138-
&tinfo));
138+
&tinfo, fcinfo->flinfo));
139139
}
140140

141141

@@ -146,7 +146,7 @@ gbt_numeric_same(PG_FUNCTION_ARGS)
146146
Datum d2 = PG_GETARG_DATUM(1);
147147
bool *result = (bool *) PG_GETARG_POINTER(2);
148148

149-
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
149+
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
150150
PG_RETURN_POINTER(result);
151151
}
152152

@@ -171,7 +171,7 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS)
171171

172172
rk = gbt_var_key_readable(org);
173173
uni = PointerGetDatum(gbt_var_key_copy(&rk));
174-
gbt_var_bin_union(&uni, newe, PG_GET_COLLATION(), &tinfo);
174+
gbt_var_bin_union(&uni, newe, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
175175
ok = gbt_var_key_readable(org);
176176
uk = gbt_var_key_readable((GBT_VARKEY *) DatumGetPointer(uni));
177177

@@ -233,6 +233,6 @@ gbt_numeric_picksplit(PG_FUNCTION_ARGS)
233233
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
234234

235235
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
236-
&tinfo);
236+
&tinfo, fcinfo->flinfo);
237237
PG_RETURN_POINTER(v);
238238
}

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