Refactor calculating count in GetLockConflicts

Refactors implementation of calculating the result count in
GetLockConflictsCompat in PG 11 and earlier, so it follows the
implementation as in PG 12.
This commit is contained in:
Ruslan Fomkin 2020-02-14 13:45:57 +01:00 committed by Erik Nordström
parent 9a3211f3aa
commit 68e64f6540

View File

@ -45,12 +45,9 @@ GetLockConflictsCompat(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
VirtualTransactionId *ids = GetLockConflicts(locktag, lockmode);
if (countp != NULL)
{
VirtualTransactionId *i = ids;
*countp = 0;
while (VirtualTransactionIdIsValid(*i))
for (*countp = 0; VirtualTransactionIdIsValid(ids[*countp]); (*countp)++)
{
i += 1;
*countp += 1;
/* Counts the number of virtual transactions ids into countp */
}
}
return ids;