authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-09-19 22:44:31+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-09-23 22:01:08+01:00
log5fa260ba065f28632af133d07441d8a611fba15b
treef9fe93e87b501cab6dd9e2c7b975f4ec34eefa1a
parent759b0fe00a5c58d498f758dcafe1abb20f6c40b6
signaturelock-open Commit is signed but in an unrecognized format.

InternPool: do not append sentinel value twice when initializing aggregate of u8


1 files changed, 2 insertions(+), 2 deletions(-)

src/InternPool.zig+2-2
...@@ -5075,8 +5075,8 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index {...@@ -5075,8 +5075,8 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index {
5075 try ip.string_bytes.ensureUnusedCapacity(gpa, @as(usize, @intCast(len_including_sentinel + 1)));5075 try ip.string_bytes.ensureUnusedCapacity(gpa, @as(usize, @intCast(len_including_sentinel + 1)));
5076 try ip.extra.ensureUnusedCapacity(gpa, @typeInfo(Bytes).Struct.fields.len);5076 try ip.extra.ensureUnusedCapacity(gpa, @typeInfo(Bytes).Struct.fields.len);
5077 switch (aggregate.storage) {5077 switch (aggregate.storage) {
5078 .bytes => |bytes| ip.string_bytes.appendSliceAssumeCapacity(bytes),5078 .bytes => |bytes| ip.string_bytes.appendSliceAssumeCapacity(bytes[0..@intCast(len)]),
5079 .elems => |elems| for (elems) |elem| switch (ip.indexToKey(elem)) {5079 .elems => |elems| for (elems[0..@intCast(len)]) |elem| switch (ip.indexToKey(elem)) {
5080 .undef => {5080 .undef => {
5081 ip.string_bytes.shrinkRetainingCapacity(string_bytes_index);5081 ip.string_bytes.shrinkRetainingCapacity(string_bytes_index);
5082 break :bytes;5082 break :bytes;