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 | 09391ddc9578f1526baeb8590b1b48b9249cef8b (patch) | |
| tree | 86d2dc3f446d42415bd80ad554e2ec4bf668aba1 | |
| parent | 9ebe6fdc5c684c21a44aeaf98837c54d7415ca2a (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-
| -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 3de8d47e9d7..b4573187c63 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -840,7 +840,6 @@ SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key) SH_SCOPE void SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) { - int i; uint64 startelem = PG_UINT64_MAX; /* @@ -848,7 +847,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]; @@ -859,6 +858,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) } } + /* we should have found an empty element */ Assert(startelem < SH_MAX_SIZE); /* |
