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

Commita77315f

Browse files
committed
Remove RangeIOData->typiofunc
We used to carry the I/O function OID in RangeIOData, but it's not usedfor anything. Since the struct is not exposed to the world anyway, wecan simplify it a bit. Also, rename the FmgrInfo member to matchthe accompanying 'typioparam' and put them in a more sensible order.Reviewed by Tom Lane and Paul Jungwirth.Discussion:https://postgr.es/m/20200304215711.GA8732@alvherre.pgsql
1 parent0065174 commita77315f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎src/backend/utils/adt/rangetypes.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@
4949
typedefstructRangeIOData
5050
{
5151
TypeCacheEntry*typcache;/* range type's typcache entry */
52-
Oidtypiofunc;/* element type's I/O function */
52+
FmgrInfotypioproc;/* element type's I/O function */
5353
Oidtypioparam;/* element type's I/O parameter */
54-
FmgrInfoproc;/* lookup result for typiofunc */
5554
}RangeIOData;
5655

5756

@@ -100,10 +99,10 @@ range_in(PG_FUNCTION_ARGS)
10099

101100
/* call element type's input function */
102101
if (RANGE_HAS_LBOUND(flags))
103-
lower.val=InputFunctionCall(&cache->proc,lbound_str,
102+
lower.val=InputFunctionCall(&cache->typioproc,lbound_str,
104103
cache->typioparam,typmod);
105104
if (RANGE_HAS_UBOUND(flags))
106-
upper.val=InputFunctionCall(&cache->proc,ubound_str,
105+
upper.val=InputFunctionCall(&cache->typioproc,ubound_str,
107106
cache->typioparam,typmod);
108107

109108
lower.infinite= (flags&RANGE_LB_INF)!=0;
@@ -142,9 +141,9 @@ range_out(PG_FUNCTION_ARGS)
142141

143142
/* call element type's output function */
144143
if (RANGE_HAS_LBOUND(flags))
145-
lbound_str=OutputFunctionCall(&cache->proc,lower.val);
144+
lbound_str=OutputFunctionCall(&cache->typioproc,lower.val);
146145
if (RANGE_HAS_UBOUND(flags))
147-
ubound_str=OutputFunctionCall(&cache->proc,upper.val);
146+
ubound_str=OutputFunctionCall(&cache->typioproc,upper.val);
148147

149148
/* construct result string */
150149
output_str=range_deparse(flags,lbound_str,ubound_str);
@@ -199,7 +198,7 @@ range_recv(PG_FUNCTION_ARGS)
199198
initStringInfo(&bound_buf);
200199
appendBinaryStringInfo(&bound_buf,bound_data,bound_len);
201200

202-
lower.val=ReceiveFunctionCall(&cache->proc,
201+
lower.val=ReceiveFunctionCall(&cache->typioproc,
203202
&bound_buf,
204203
cache->typioparam,
205204
typmod);
@@ -217,7 +216,7 @@ range_recv(PG_FUNCTION_ARGS)
217216
initStringInfo(&bound_buf);
218217
appendBinaryStringInfo(&bound_buf,bound_data,bound_len);
219218

220-
upper.val=ReceiveFunctionCall(&cache->proc,
219+
upper.val=ReceiveFunctionCall(&cache->typioproc,
221220
&bound_buf,
222221
cache->typioparam,
223222
typmod);
@@ -268,7 +267,7 @@ range_send(PG_FUNCTION_ARGS)
268267

269268
if (RANGE_HAS_LBOUND(flags))
270269
{
271-
Datumbound=PointerGetDatum(SendFunctionCall(&cache->proc,
270+
Datumbound=PointerGetDatum(SendFunctionCall(&cache->typioproc,
272271
lower.val));
273272
uint32bound_len=VARSIZE(bound)-VARHDRSZ;
274273
char*bound_data=VARDATA(bound);
@@ -279,7 +278,7 @@ range_send(PG_FUNCTION_ARGS)
279278

280279
if (RANGE_HAS_UBOUND(flags))
281280
{
282-
Datumbound=PointerGetDatum(SendFunctionCall(&cache->proc,
281+
Datumbound=PointerGetDatum(SendFunctionCall(&cache->typioproc,
283282
upper.val));
284283
uint32bound_len=VARSIZE(bound)-VARHDRSZ;
285284
char*bound_data=VARDATA(bound);
@@ -309,6 +308,7 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
309308
booltypbyval;
310309
chartypalign;
311310
chartypdelim;
311+
Oidtypiofunc;
312312

313313
cache= (RangeIOData*)MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
314314
sizeof(RangeIOData));
@@ -324,9 +324,9 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
324324
&typalign,
325325
&typdelim,
326326
&cache->typioparam,
327-
&cache->typiofunc);
327+
&typiofunc);
328328

329-
if (!OidIsValid(cache->typiofunc))
329+
if (!OidIsValid(typiofunc))
330330
{
331331
/* this could only happen for receive or send */
332332
if (func==IOFunc_receive)
@@ -340,7 +340,7 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
340340
errmsg("no binary output function available for type %s",
341341
format_type_be(cache->typcache->rngelemtype->type_id))));
342342
}
343-
fmgr_info_cxt(cache->typiofunc,&cache->proc,
343+
fmgr_info_cxt(typiofunc,&cache->typioproc,
344344
fcinfo->flinfo->fn_mcxt);
345345

346346
fcinfo->flinfo->fn_extra= (void*)cache;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp