Skip to content

Commit 9f23619

Browse files
committed
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-
1 parent 2d3983a commit 9f23619

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/include/lib/simplehash.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,15 +772,14 @@ SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key)
772772
SH_SCOPE void
773773
SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
774774
{
775-
int i;
776775
uint64 startelem = PG_UINT64_MAX;
777776

778777
/*
779778
* Search for the first empty element. As deletions during iterations are
780779
* supported, we want to start/end at an element that cannot be affected
781780
* by elements being shifted.
782781
*/
783-
for (i = 0; i < tb->size; i++)
782+
for (uint32 i = 0; i < tb->size; i++)
784783
{
785784
SH_ELEMENT_TYPE *entry = &tb->data[i];
786785

@@ -791,6 +790,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
791790
}
792791
}
793792

793+
/* we should have found an empty element */
794794
Assert(startelem < SH_MAX_SIZE);
795795

796796
/*

0 commit comments

Comments
 (0)