diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-08-22 20:05:49 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-11-29 09:56:49 -0500 |
commit | c7f5c58e1c6bb250ff7c24970a05e033201be409 (patch) | |
tree | 0a4b1dd4dff2755422bb96f35901607a26fd3536 | |
parent | cdddd5d40b8a8b37db18adda3912e029756d1e36 (diff) | |
download | postgresql-c7f5c58e1c6bb250ff7c24970a05e033201be409.tar.gz postgresql-c7f5c58e1c6bb250ff7c24970a05e033201be409.zip |
PL/Python: Fix remaining scan-build warnings
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>
-rw-r--r-- | src/pl/plpython/plpy_exec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index 9d2341a4a3b..fe217c6a2c1 100644 --- a/src/pl/plpython/plpy_exec.c +++ b/src/pl/plpython/plpy_exec.c @@ -57,6 +57,7 @@ static void PLy_abort_open_subtransactions(int save_subxact_level); Datum PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc) { + bool is_setof = proc->is_setof; Datum rv; PyObject *volatile plargs = NULL; PyObject *volatile plrv = NULL; @@ -73,7 +74,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc) PG_TRY(); { - if (proc->is_setof) + if (is_setof) { /* First Call setup */ if (SRF_IS_FIRSTCALL()) @@ -93,6 +94,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc) funcctx = SRF_PERCALL_SETUP(); Assert(funcctx != NULL); srfstate = (PLySRFState *) funcctx->user_fctx; + Assert(srfstate != NULL); } if (srfstate == NULL || srfstate->iter == NULL) @@ -125,7 +127,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc) * 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) { |