Skip to content

Commit c65f7dd

Browse files
committed
Store sub_type as a [*c]const u8
Makes the @sizeof(ExternalEntry) 16, instead of 24 and works just as well with the string literal we expect it to be set to.
1 parent 8ff4406 commit c65f7dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/engines/v8/v8.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ pub const ExternalEntry = struct {
717717
// the proper subtype (and description) fields in the returned JSON.
718718
// V8 will give us a Value and ask us for the subtype. Hence, we store it
719719
// here.
720-
sub_type: ?[:0]const u8,
720+
sub_type: ?[*c]const u8,
721721
};
722722

723723
// See above for documentation for the ExternalEntry's sub_type field.

src/reflect.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ pub const Struct = struct {
785785

786786
// nested types
787787
nested: []const StructNested,
788-
sub_type: ?[:0]const u8,
788+
sub_type: ?[*c]const u8,
789789

790790
pub fn Self(comptime self: Struct) type {
791791
comptime {
@@ -1247,7 +1247,7 @@ pub const Struct = struct {
12471247
mem_guarantied = @typeInfo(T).@"struct".layout != .auto;
12481248
}
12491249

1250-
var sub_type: ?[:0]const u8 = null;
1250+
var sub_type: ?[*c]const u8 = null;
12511251
if (@hasDecl(T, "sub_type")) {
12521252
sub_type = @field(T, "sub_type");
12531253
}

0 commit comments

Comments
 (0)