diff options
author | Fujii Masao <fujii@postgresql.org> | 2021-09-16 13:07:29 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2021-09-16 13:08:00 +0900 |
commit | 24c57aa62937d2dc8b5e91c1ec95e0f8966fb0c4 (patch) | |
tree | 8f041530d51bcc399009d12cc0f71b7fb3cda5e8 /src/backend/storage | |
parent | 43849b65f3338acad50d9bdf607d2d573f8079c6 (diff) | |
download | postgresql-24c57aa62937d2dc8b5e91c1ec95e0f8966fb0c4.tar.gz postgresql-24c57aa62937d2dc8b5e91c1ec95e0f8966fb0c4.zip |
Fix variable shadowing in procarray.c.
ProcArrayGroupClearXid function has a parameter named "proc",
but the same name was used for its local variables. This commit fixes
this variable shadowing, to improve code readability.
Back-patch to all supported versions, to make future back-patching
easy though this patch is classified as refactoring only.
Reported-by: Ranier Vilela
Author: Ranier Vilela, Aleksander Alekseev
https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/ipc/procarray.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index fc5bb6dc263..33bfde34042 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -552,13 +552,13 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid) /* Walk the list and clear all XIDs. */ while (nextidx != INVALID_PGPROCNO) { - PGPROC *proc = &allProcs[nextidx]; + PGPROC *nextproc = &allProcs[nextidx]; PGXACT *pgxact = &allPgXact[nextidx]; - ProcArrayEndTransactionInternal(proc, pgxact, proc->procArrayGroupMemberXid); + ProcArrayEndTransactionInternal(nextproc, pgxact, nextproc->procArrayGroupMemberXid); /* Move to next proc in list. */ - nextidx = pg_atomic_read_u32(&proc->procArrayGroupNext); + nextidx = pg_atomic_read_u32(&nextproc->procArrayGroupNext); } /* We're done with the lock now. */ @@ -573,18 +573,18 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid) */ while (wakeidx != INVALID_PGPROCNO) { - PGPROC *proc = &allProcs[wakeidx]; + PGPROC *nextproc = &allProcs[wakeidx]; - wakeidx = pg_atomic_read_u32(&proc->procArrayGroupNext); - pg_atomic_write_u32(&proc->procArrayGroupNext, INVALID_PGPROCNO); + wakeidx = pg_atomic_read_u32(&nextproc->procArrayGroupNext); + pg_atomic_write_u32(&nextproc->procArrayGroupNext, INVALID_PGPROCNO); /* ensure all previous writes are visible before follower continues. */ pg_write_barrier(); - proc->procArrayGroupMember = false; + nextproc->procArrayGroupMember = false; - if (proc != MyProc) - PGSemaphoreUnlock(proc->sem); + if (nextproc != MyProc) + PGSemaphoreUnlock(nextproc->sem); } } |