Skip to content

Commit 64a62eb

Browse files
committed
Use int instead of size_t in procarray.c.
All size_t variables declared in procarray.c are actually int ones. Let's use int instead of size_t for those variables. Which would reduce Wsign-compare compiler warnings. Back-patch to v14 where commit 941697c added size_t variables in procarray.c, 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 0c39c29 commit 64a62eb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
714714
static inline void
715715
ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid)
716716
{
717-
size_t pgxactoff = proc->pgxactoff;
717+
int pgxactoff = proc->pgxactoff;
718718

719719
/*
720720
* Note: we need exclusive lock here because we're going to change other
@@ -886,7 +886,7 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
886886
void
887887
ProcArrayClearTransaction(PGPROC *proc)
888888
{
889-
size_t pgxactoff;
889+
int pgxactoff;
890890

891891
/*
892892
* Currently we need to lock ProcArrayLock exclusively here, as we
@@ -1366,7 +1366,7 @@ TransactionIdIsInProgress(TransactionId xid)
13661366
TransactionId topxid;
13671367
TransactionId latestCompletedXid;
13681368
int mypgxactoff;
1369-
size_t numProcs;
1369+
int numProcs;
13701370
int j;
13711371

13721372
/*
@@ -1443,7 +1443,7 @@ TransactionIdIsInProgress(TransactionId xid)
14431443
/* No shortcuts, gotta grovel through the array */
14441444
mypgxactoff = MyProc->pgxactoff;
14451445
numProcs = arrayP->numProcs;
1446-
for (size_t pgxactoff = 0; pgxactoff < numProcs; pgxactoff++)
1446+
for (int pgxactoff = 0; pgxactoff < numProcs; pgxactoff++)
14471447
{
14481448
int pgprocno;
14491449
PGPROC *proc;
@@ -2209,7 +2209,7 @@ GetSnapshotData(Snapshot snapshot)
22092209
TransactionId *other_xids = ProcGlobal->xids;
22102210
TransactionId xmin;
22112211
TransactionId xmax;
2212-
size_t count = 0;
2212+
int count = 0;
22132213
int subcount = 0;
22142214
bool suboverflowed = false;
22152215
FullTransactionId latest_completed;
@@ -2291,7 +2291,7 @@ GetSnapshotData(Snapshot snapshot)
22912291

22922292
if (!snapshot->takenDuringRecovery)
22932293
{
2294-
size_t numProcs = arrayP->numProcs;
2294+
int numProcs = arrayP->numProcs;
22952295
TransactionId *xip = snapshot->xip;
22962296
int *pgprocnos = arrayP->pgprocnos;
22972297
XidCacheStatus *subxidStates = ProcGlobal->subxidStates;
@@ -2301,7 +2301,7 @@ GetSnapshotData(Snapshot snapshot)
23012301
* First collect set of pgxactoff/xids that need to be included in the
23022302
* snapshot.
23032303
*/
2304-
for (size_t pgxactoff = 0; pgxactoff < numProcs; pgxactoff++)
2304+
for (int pgxactoff = 0; pgxactoff < numProcs; pgxactoff++)
23052305
{
23062306
/* Fetch xid just once - see GetNewTransactionId */
23072307
TransactionId xid = UINT32_ACCESS_ONCE(other_xids[pgxactoff]);

0 commit comments

Comments
 (0)