@@ -50,7 +50,7 @@ static TypeFuncClass get_type_func_class(Oid typid, Oid *base_typeid);
50
50
* and error checking
51
51
*/
52
52
FuncCallContext *
53
- init_MultiFuncCall (PG_FUNCTION_ARGS )
53
+ init_MultiFuncCall (PG_FUNCTION_ARGS , FuncCallContext * * pfuncctx )
54
54
{
55
55
FuncCallContext * retval ;
56
56
@@ -62,7 +62,7 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
62
62
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
63
63
errmsg ("set-valued function called in context that cannot accept a set" )));
64
64
65
- if (fcinfo -> flinfo -> fn_extra == NULL )
65
+ if (* pfuncctx == NULL )
66
66
{
67
67
/*
68
68
* First call
@@ -97,15 +97,15 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
97
97
/*
98
98
* save the pointer for cross-call use
99
99
*/
100
- fcinfo -> flinfo -> fn_extra = retval ;
100
+ * pfuncctx = retval ;
101
101
102
102
/*
103
103
* Ensure we will get shut down cleanly if the exprcontext is not run
104
104
* to completion.
105
105
*/
106
106
RegisterExprContextCallback (rsi -> econtext ,
107
107
shutdown_MultiFuncCall ,
108
- PointerGetDatum (fcinfo -> flinfo ));
108
+ PointerGetDatum (pfuncctx ));
109
109
}
110
110
else
111
111
{
@@ -125,9 +125,9 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
125
125
* Do Multi-function per-call setup
126
126
*/
127
127
FuncCallContext *
128
- per_MultiFuncCall (PG_FUNCTION_ARGS )
128
+ per_MultiFuncCall (PG_FUNCTION_ARGS , FuncCallContext * * pfuncctx )
129
129
{
130
- FuncCallContext * retval = ( FuncCallContext * ) fcinfo -> flinfo -> fn_extra ;
130
+ FuncCallContext * retval = * pfuncctx ;
131
131
132
132
return retval ;
133
133
}
@@ -137,17 +137,18 @@ per_MultiFuncCall(PG_FUNCTION_ARGS)
137
137
* Clean up after init_MultiFuncCall
138
138
*/
139
139
void
140
- end_MultiFuncCall (PG_FUNCTION_ARGS , FuncCallContext * funcctx )
140
+ end_MultiFuncCall (PG_FUNCTION_ARGS , FuncCallContext * funcctx ,
141
+ FuncCallContext * * pfuncctx )
141
142
{
142
143
ReturnSetInfo * rsi = (ReturnSetInfo * ) fcinfo -> resultinfo ;
143
144
144
145
/* Deregister the shutdown callback */
145
146
UnregisterExprContextCallback (rsi -> econtext ,
146
147
shutdown_MultiFuncCall ,
147
- PointerGetDatum (fcinfo -> flinfo ));
148
+ PointerGetDatum (pfuncctx ));
148
149
149
150
/* But use it to do the real work */
150
- shutdown_MultiFuncCall (PointerGetDatum (fcinfo -> flinfo ));
151
+ shutdown_MultiFuncCall (PointerGetDatum (pfuncctx ));
151
152
}
152
153
153
154
/*
@@ -157,11 +158,11 @@ end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx)
157
158
static void
158
159
shutdown_MultiFuncCall (Datum arg )
159
160
{
160
- FmgrInfo * flinfo = (FmgrInfo * ) DatumGetPointer (arg );
161
- FuncCallContext * funcctx = ( FuncCallContext * ) flinfo -> fn_extra ;
161
+ FuncCallContext * * pfuncctx = (FuncCallContext * * ) DatumGetPointer (arg );
162
+ FuncCallContext * funcctx = * pfuncctx ;
162
163
163
164
/* unbind from flinfo */
164
- flinfo -> fn_extra = NULL ;
165
+ * pfuncctx = NULL ;
165
166
166
167
/*
167
168
* Delete context that holds all multi-call data, including the
0 commit comments