work around zig json bug

This commit is contained in:
LordMZTE 2023-06-27 23:20:35 +02:00
parent 64b8b9e715
commit 3cd8cdb2ce
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
3 changed files with 5 additions and 3 deletions

View file

@ -17,7 +17,9 @@ pub fn confgenGet(comptime T: type, root_path: []const u8, alloc: std.mem.Alloca
.init(alloc, buf_reader.reader());
defer reader.deinit();
const ret = try std.json.parseFromTokenSource(T, alloc, &reader, confgen_json_opt);
// We just grab the value from the parse result as this data will almost certainly have been
// allocated with the builder's arena anyways.
return (try std.json.parseFromTokenSource(T, alloc, &reader, confgen_json_opt)).value;
return ret.value;
}

View file

@ -20,7 +20,7 @@ pub fn build(b: *std.build.Builder) !void {
const znvim_dep = b.dependency("znvim", .{ .target = target, .optimize = mode });
const cg_opt = try common.confgenGet(struct {
term_font: []const u8,
term_font: []u8, // TODO: this being non-const is a workaround for an std bug
}, "..", b.allocator);
const opts = b.addOptions();

View file

@ -17,7 +17,7 @@ pub fn build(b: *std.build.Builder) !void {
exe.addModule("ansi-term", b.dependency("ansi_term", .{}).module("ansi-term"));
const cg_opt = try common.confgenGet(struct {
gtk_theme: []const u8,
gtk_theme: []u8, // TODO: this being non-const is a workaround for an std bug
}, "../..", b.allocator);
const opts = b.addOptions();