mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
config: packed struct fields can clone directly via copy
This commit is contained in:
@ -4,6 +4,7 @@ const Config = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const assert = std.debug.assert;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
const fontpkg = @import("../font/main.zig");
|
||||
@ -1370,7 +1371,11 @@ fn cloneValue(alloc: Allocator, comptime T: type, src: T) !T {
|
||||
src orelse return null,
|
||||
),
|
||||
|
||||
.Struct => return try src.clone(alloc),
|
||||
.Struct => |info| {
|
||||
// Packed structs we can return directly as copies.
|
||||
assert(info.layout == .Packed);
|
||||
return src;
|
||||
},
|
||||
|
||||
else => {
|
||||
@compileLog(T);
|
||||
|
Reference in New Issue
Block a user