diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-09-19 22:44:31 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2023-09-23 22:01:08 +0100 |
| commit | 5fa260ba065f28632af133d07441d8a611fba15b (patch) | |
| tree | f9fe93e87b501cab6dd9e2c7b975f4ec34eefa1a /src | |
| parent | 759b0fe00a5c58d498f758dcafe1abb20f6c40b6 (diff) | |
| download | zig-5fa260ba065f28632af133d07441d8a611fba15b.tar.gz zig-5fa260ba065f28632af133d07441d8a611fba15b.zip | |
InternPool: do not append sentinel value twice when initializing aggregate of u8
Diffstat (limited to 'src')
| -rw-r--r-- | src/InternPool.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig index 79d4127787..368ef51826 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -5075,8 +5075,8 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { try ip.string_bytes.ensureUnusedCapacity(gpa, @as(usize, @intCast(len_including_sentinel + 1))); try ip.extra.ensureUnusedCapacity(gpa, @typeInfo(Bytes).Struct.fields.len); switch (aggregate.storage) { - .bytes => |bytes| ip.string_bytes.appendSliceAssumeCapacity(bytes), - .elems => |elems| for (elems) |elem| switch (ip.indexToKey(elem)) { + .bytes => |bytes| ip.string_bytes.appendSliceAssumeCapacity(bytes[0..@intCast(len)]), + .elems => |elems| for (elems[0..@intCast(len)]) |elem| switch (ip.indexToKey(elem)) { .undef => { ip.string_bytes.shrinkRetainingCapacity(string_bytes_index); break :bytes; |
