mirror of
https://github.com/ziglang/zig.git
synced 2025-12-26 16:13:07 +00:00
InternPool: do not append sentinel value twice when initializing aggregate of u8
This commit is contained in:
parent
759b0fe00a
commit
5fa260ba06
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user