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:33 -0700 |
commit | 9f236198c31de5340bd2227438b239a465c6eab3 (patch) | |
tree | 207ab423aa9fea0d4f7e3398d83a9b5be9afab12 /src/include | |
parent | 2d3983aea5db679fdd1b286ded792692580e8f3f (diff) | |
download | postgresql-9f236198c31de5340bd2227438b239a465c6eab3.tar.gz postgresql-9f236198c31de5340bd2227438b239a465c6eab3.zip |
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/include')
-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 664febe54cc..145d9db50ec 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -772,7 +772,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; /* @@ -780,7 +779,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]; @@ -791,6 +790,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) } } + /* we should have found an empty element */ Assert(startelem < SH_MAX_SIZE); /* |