1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 07:04:08 +00:00

fix hello_json

This commit is contained in:
renerocksai 2025-08-28 20:29:11 +02:00
parent 5740b3b1a1
commit 23162dbe2e
No known key found for this signature in database

View file

@ -75,12 +75,11 @@ pub fn toCharPtr(s: []const u8) [*c]u8 {
pub fn stringifyBuf(
buffer: []u8,
value: anytype,
options: std.json.StringifyOptions,
options: std.json.Stringify.Options,
) ![]const u8 {
var fba = std.heap.FixedBufferAllocator.init(buffer);
var string = std.ArrayList(u8).init(fba.allocator());
if (std.json.stringify(value, options, string.writer())) {
return string.items;
var w: std.io.Writer = .fixed(buffer);
if (std.json.Stringify.value(value, options, &w)) {
return w.buffered();
} else |err| { // error
return err;
}