Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f0a94d8

Browse filesBrowse 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
Copy full SHA for f0a94d8

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎src/include/lib/simplehash.h

Copy file name to clipboardExpand all lines: src/include/lib/simplehash.h
+2-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.