From cd4e8caaa0eb5c3d3b12a45b29035e7a4bdfa4a8 Mon Sep 17 00:00:00 2001 From: David Rowley Date: Fri, 7 Oct 2022 13:13:27 +1300 Subject: Fix final warnings produced by -Wshadow=compatible-local I thought I had these in d8df67bb1, but per report from Andres Freund, I missed some. Reviewed-by: Andres Freund Discussion: https://postgr.es/m/20221005214052.c4tkudawyp5wxt3c@awork3.anarazel.de --- src/interfaces/libpq/fe-secure-gssapi.c | 12 ++++++------ src/pl/plpython/plpy_cursorobject.c | 6 +++--- src/pl/plpython/plpy_exec.c | 2 -- src/pl/plpython/plpy_spi.c | 6 +++--- src/test/modules/test_integerset/test_integerset.c | 20 ++++++++++---------- 5 files changed, 22 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/interfaces/libpq/fe-secure-gssapi.c b/src/interfaces/libpq/fe-secure-gssapi.c index 6ea52ed866..dee0982eba 100644 --- a/src/interfaces/libpq/fe-secure-gssapi.c +++ b/src/interfaces/libpq/fe-secure-gssapi.c @@ -135,11 +135,11 @@ pg_GSS_write(PGconn *conn, const void *ptr, size_t len) */ if (PqGSSSendLength) { - ssize_t ret; + ssize_t retval; ssize_t amount = PqGSSSendLength - PqGSSSendNext; - ret = pqsecure_raw_write(conn, PqGSSSendBuffer + PqGSSSendNext, amount); - if (ret <= 0) + retval = pqsecure_raw_write(conn, PqGSSSendBuffer + PqGSSSendNext, amount); + if (retval <= 0) { /* * Report any previously-sent data; if there was none, reflect @@ -149,16 +149,16 @@ pg_GSS_write(PGconn *conn, const void *ptr, size_t len) */ if (bytes_sent) return bytes_sent; - return ret; + return retval; } /* * Check if this was a partial write, and if so, move forward that * far in our buffer and try again. */ - if (ret != amount) + if (retval != amount) { - PqGSSSendNext += ret; + PqGSSSendNext += retval; continue; } diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c index 6b6e743345..57e8f8ec21 100644 --- a/src/pl/plpython/plpy_cursorobject.c +++ b/src/pl/plpython/plpy_cursorobject.c @@ -215,18 +215,18 @@ PLy_cursor_plan(PyObject *ob, PyObject *args) PyObject *elem; elem = PySequence_GetItem(args, j); - PG_TRY(); + PG_TRY(2); { bool isnull; plan->values[j] = PLy_output_convert(arg, elem, &isnull); nulls[j] = isnull ? 'n' : ' '; } - PG_FINALLY(); + PG_FINALLY(2); { Py_DECREF(elem); } - PG_END_TRY(); + PG_END_TRY(2); } portal = SPI_cursor_open(NULL, plan->plan, plan->values, nulls, diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index 150b3a5977..923703535a 100644 --- a/src/pl/plpython/plpy_exec.c +++ b/src/pl/plpython/plpy_exec.c @@ -375,8 +375,6 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc) rv = NULL; else if (pg_strcasecmp(srv, "MODIFY") == 0) { - TriggerData *tdata = (TriggerData *) fcinfo->context; - if (TRIGGER_FIRED_BY_INSERT(tdata->tg_event) || TRIGGER_FIRED_BY_UPDATE(tdata->tg_event)) rv = PLy_modify_tuple(proc, plargs, tdata, rv); diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c index 9a71a42c15..6b9f8d5b43 100644 --- a/src/pl/plpython/plpy_spi.c +++ b/src/pl/plpython/plpy_spi.c @@ -236,18 +236,18 @@ PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit) PyObject *elem; elem = PySequence_GetItem(list, j); - PG_TRY(); + PG_TRY(2); { bool isnull; plan->values[j] = PLy_output_convert(arg, elem, &isnull); nulls[j] = isnull ? 'n' : ' '; } - PG_FINALLY(); + PG_FINALLY(2); { Py_DECREF(elem); } - PG_END_TRY(); + PG_END_TRY(2); } rv = SPI_execute_plan(plan->plan, plan->values, nulls, diff --git a/src/test/modules/test_integerset/test_integerset.c b/src/test/modules/test_integerset/test_integerset.c index 578d2e8aec..813ca4ba6b 100644 --- a/src/test/modules/test_integerset/test_integerset.c +++ b/src/test/modules/test_integerset/test_integerset.c @@ -585,26 +585,26 @@ test_huge_distances(void) */ for (int i = 0; i < num_values; i++) { - uint64 x = values[i]; + uint64 y = values[i]; bool expected; bool result; - if (x > 0) + if (y > 0) { - expected = (values[i - 1] == x - 1); - result = intset_is_member(intset, x - 1); + expected = (values[i - 1] == y - 1); + result = intset_is_member(intset, y - 1); if (result != expected) - elog(ERROR, "intset_is_member failed for " UINT64_FORMAT, x - 1); + elog(ERROR, "intset_is_member failed for " UINT64_FORMAT, y - 1); } - result = intset_is_member(intset, x); + result = intset_is_member(intset, y); if (result != true) - elog(ERROR, "intset_is_member failed for " UINT64_FORMAT, x); + elog(ERROR, "intset_is_member failed for " UINT64_FORMAT, y); - expected = (i != num_values - 1) ? (values[i + 1] == x + 1) : false; - result = intset_is_member(intset, x + 1); + expected = (i != num_values - 1) ? (values[i + 1] == y + 1) : false; + result = intset_is_member(intset, y + 1); if (result != expected) - elog(ERROR, "intset_is_member failed for " UINT64_FORMAT, x + 1); + elog(ERROR, "intset_is_member failed for " UINT64_FORMAT, y + 1); } /* -- cgit v1.2.1