Apparently, scan-build thinks that proc->is_setof can change during
PLy_exec_function(). To make it clearer, save the value in a local
variable.
Also add an assertion to clear another warning.
Reviewed-by: John Naylor <jcnaylor@gmail.com>
Datum
PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
{
+ bool is_setof = proc->is_setof;
Datum rv;
PyObject *volatile plargs = NULL;
PyObject *volatile plrv = NULL;
PG_TRY();
{
- if (proc->is_setof)
+ if (is_setof)
{
/* First Call setup */
if (SRF_IS_FIRSTCALL())
funcctx = SRF_PERCALL_SETUP();
Assert(funcctx != NULL);
srfstate = (PLySRFState *) funcctx->user_fctx;
+ Assert(srfstate != NULL);
}
if (srfstate == NULL || srfstate->iter == NULL)
* We stay in the SPI context while doing this, because PyIter_Next()
* calls back into Python code which might contain SPI calls.
*/
- if (proc->is_setof)
+ if (is_setof)
{
if (srfstate->iter == NULL)
{