fix: remove arbitrary limit to command buffer size

This commit is contained in:
CJ van den Berg 2025-03-18 21:41:19 +01:00
parent 1788d4dfb2
commit 34000cccbf
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -13,10 +13,14 @@ pub const Context = struct {
args: tp.message = .{},
pub fn fmt(value: anytype) Context {
return .{ .args = tp.message.fmtbuf(&context_buffer, value) catch @panic("command.Context.fmt failed") };
context_buffer.clearRetainingCapacity();
cbor.writeValue(context_buffer.writer(), value) catch @panic("command.Context.fmt failed");
return .{ .args = .{ .buf = context_buffer.items } };
}
};
threadlocal var context_buffer: [tp.max_message_size]u8 = undefined;
const context_buffer_allocator = std.heap.c_allocator;
threadlocal var context_buffer: std.ArrayList(u8) = std.ArrayList(u8).init(context_buffer_allocator);
pub const fmt = Context.fmt;
const Vtable = struct {