Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc89914

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 fixesthis variable shadowing, to improve code readability.Back-patch to all supported versions, to make future back-patchingeasy though this patch is classified as refactoring only.Reported-by: Ranier VilelaAuthor: Ranier Vilela, Aleksander Alekseevhttps://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com
1 parent64a62eb commitdc89914

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)

[8]ページ先頭

©2009-2025 Movatter.jp