aboutsummaryrefslogtreecommitdiff
path: root/src/RangeSet.zig
diff options
context:
space:
mode:
authorsentientwaffle <sentientwaffle@gmail.com>2023-06-09 12:52:36 -0700
committerVeikka Tuominen <git@vexu.eu>2023-06-10 02:24:35 +0300
commitf04e65bc09ab77eafc317b2d2981970509aae6af (patch)
tree707964d29fbc65bc693fe543a47c14f5231f4e52 /src/RangeSet.zig
parent99fe2a23c0b45395be3c71192aeaeaea77e1fb0c (diff)
downloadzig-f04e65bc09ab77eafc317b2d2981970509aae6af.tar.gz
zig-f04e65bc09ab77eafc317b2d2981970509aae6af.zip
std.hash_map: fetchRemove increment available
To avoid leaking slots, `fetchRemove` must increment `available` (when the "fetch" succeeds). Without the `available += 1`, the added test `"std.hash_map repeat fetchRemove"` fails with run test std-x86-linux-none-Debug: error: thread 432734 panic: integer overflow .../zig/lib/std/hash_map.zig:1365:28: 0x6471d5 in getOrPutAssumeCapacityAdapted__anon_47495 (test) self.available -= 1; ^ .../zig/lib/std/hash_map.zig:1308:62: 0x616950 in getOrPutAssumeCapacityContext (test) const result = self.getOrPutAssumeCapacityAdapted(key, ctx); ^ Alternatively, `fetchRemove` could call `removeByIndex`, though that would entail calling `header()` twice instead of once.
Diffstat (limited to 'src/RangeSet.zig')
0 files changed, 0 insertions, 0 deletions