Skip to content

Commit f0a94d8

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 1fa25ce commit f0a94d8

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
@@ -964,15 +964,14 @@ SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry)
964964
SH_SCOPE void
965965
SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
966966
{
967-
int i;
968967
uint64 startelem = PG_UINT64_MAX;
969968

970969
/*
971970
* Search for the first empty element. As deletions during iterations are
972971
* supported, we want to start/end at an element that cannot be affected
973972
* by elements being shifted.
974973
*/
975-
for (i = 0; i < tb->size; i++)
974+
for (uint32 i = 0; i < tb->size; i++)
976975
{
977976
SH_ELEMENT_TYPE *entry = &tb->data[i];
978977

@@ -983,6 +982,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
983982
}
984983
}
985984

985+
/* we should have found an empty element */
986986
Assert(startelem < SH_MAX_SIZE);
987987

988988
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy