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-
SH_SCOPE void
SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
{
- int i;
uint64 startelem = PG_UINT64_MAX;
/*
* 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];
}
}
+ /* we should have found an empty element */
Assert(startelem < SH_MAX_SIZE);
/*