aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2023-07-06 08:34:17 -0700
committerAndres Freund <andres@anarazel.de>2023-07-06 09:57:31 -0700
commitd12d1a9278dfd40694ef98fe8bc9e2d07fd1000e (patch)
tree048674b16a3c46a74e61ec5c1be571a333bec21a
parentc0cb12f9e7b33bbcd64cc93d0811bc10e17e5452 (diff)
downloadpostgresql-d12d1a9278dfd40694ef98fe8bc9e2d07fd1000e.tar.gz
postgresql-d12d1a9278dfd40694ef98fe8bc9e2d07fd1000e.zip
Fix type of iterator variable in SH_START_ITERATE
Also add comment to make the reasoning behind the Assert() more explicit (per Tom). Reported-by: Ranier Vilela Discussion: https://postgr.es/m/CAEudQAocXNJ6s1VLz+hMamLAQAiewRoW17OJ6-+9GACKfj6iPQ@mail.gmail.com Backpatch: 11-
-rw-r--r--src/include/lib/simplehash.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h
index d03a0018d5c..d95388d0175 100644
--- a/src/include/lib/simplehash.h
+++ b/src/include/lib/simplehash.h
@@ -964,7 +964,6 @@ SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry)
SH_SCOPE void
SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
{
- int i;
uint64 startelem = PG_UINT64_MAX;
/*
@@ -972,7 +971,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
* supported, we want to start/end at an element that cannot be affected
* by elements being shifted.
*/
- for (i = 0; i < tb->size; i++)
+ for (uint32 i = 0; i < tb->size; i++)
{
SH_ELEMENT_TYPE *entry = &tb->data[i];
@@ -983,6 +982,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
}
}
+ /* we should have found an empty element */
Assert(startelem < SH_MAX_SIZE);
/*