Skip to content

Commit dc89914

Browse files
committed
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
1 parent 64a62eb commit dc89914

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,12 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
840840
/* Walk the list and clear all XIDs. */
841841
while (nextidx != INVALID_PGPROCNO)
842842
{
843-
PGPROC *proc = &allProcs[nextidx];
843+
PGPROC *nextproc = &allProcs[nextidx];
844844

845-
ProcArrayEndTransactionInternal(proc, proc->procArrayGroupMemberXid);
845+
ProcArrayEndTransactionInternal(nextproc, nextproc->procArrayGroupMemberXid);
846846

847847
/* Move to next proc in list. */
848-
nextidx = pg_atomic_read_u32(&proc->procArrayGroupNext);
848+
nextidx = pg_atomic_read_u32(&nextproc->procArrayGroupNext);
849849
}
850850

851851
/* We're done with the lock now. */
@@ -860,18 +860,18 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
860860
*/
861861
while (wakeidx != INVALID_PGPROCNO)
862862
{
863-
PGPROC *proc = &allProcs[wakeidx];
863+
PGPROC *nextproc = &allProcs[wakeidx];
864864

865-
wakeidx = pg_atomic_read_u32(&proc->procArrayGroupNext);
866-
pg_atomic_write_u32(&proc->procArrayGroupNext, INVALID_PGPROCNO);
865+
wakeidx = pg_atomic_read_u32(&nextproc->procArrayGroupNext);
866+
pg_atomic_write_u32(&nextproc->procArrayGroupNext, INVALID_PGPROCNO);
867867

868868
/* ensure all previous writes are visible before follower continues. */
869869
pg_write_barrier();
870870

871-
proc->procArrayGroupMember = false;
871+
nextproc->procArrayGroupMember = false;
872872

873-
if (proc != MyProc)
874-
PGSemaphoreUnlock(proc->sem);
873+
if (nextproc != MyProc)
874+
PGSemaphoreUnlock(nextproc->sem);
875875
}
876876
}
877877

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy