config: RepeatableString.clone should clone all the strings too

This commit is contained in:
Mitchell Hashimoto
2024-04-06 10:20:16 -07:00
parent 00f677fd51
commit efb8146c28

View File

@ -2498,9 +2498,14 @@ pub const RepeatableString = struct {
/// Deep copy of the struct. Required by Config. /// Deep copy of the struct. Required by Config.
pub fn clone(self: *const Self, alloc: Allocator) !Self { pub fn clone(self: *const Self, alloc: Allocator) !Self {
return .{ // Copy the list and all the strings in the list.
.list = try self.list.clone(alloc), const list = try self.list.clone(alloc);
}; for (list.items) |*item| {
const copy = try alloc.dupeZ(u8, item.*);
item.* = copy;
}
return .{ .list = list };
} }
/// The number of itemsin the list /// The number of itemsin the list