diff options
author | Andres Freund <andres@anarazel.de> | 2023-07-06 08:34:17 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2023-07-06 09:57:32 -0700 |
commit | 1508b57d4b7a67c1febb5dd71a17c9a08359c8e4 (patch) | |
tree | 26d27b379a56d0223015eb736b07b525ccda6145 /src | |
parent | fb0f05576a0a6a452fe206a9e1d181f8f82dd882 (diff) |
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-
Diffstat (limited to 'src')
-rw-r--r-- | src/include/lib/simplehash.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 816ee5a0acd..548526f7615 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -965,7 +965,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; /* @@ -973,7 +972,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]; @@ -984,6 +983,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) } } + /* we should have found an empty element */ Assert(startelem < SH_MAX_SIZE); /* |