Fix
If the array is empty, I still ne to append 8 bytes to hold the array len
This commit is contained in:
parent
b1ce5e9923
commit
d819281fe4
@ -8,7 +8,6 @@ const ArrayCondition = @import("../ziql/parts//newData.zig").ArrayCondition;
|
|||||||
|
|
||||||
/// Update an array based on keyword like append or remove
|
/// Update an array based on keyword like append or remove
|
||||||
pub fn updateData(allocator: std.mem.Allocator, condition: ArrayCondition, input: *zid.Data, data: ?ConditionValue) !void {
|
pub fn updateData(allocator: std.mem.Allocator, condition: ArrayCondition, input: *zid.Data, data: ?ConditionValue) !void {
|
||||||
std.debug.print("HERE {any}\n", .{condition});
|
|
||||||
try switch (condition) {
|
try switch (condition) {
|
||||||
.append => append(allocator, input, data.?),
|
.append => append(allocator, input, data.?),
|
||||||
.pop => pop(allocator, input),
|
.pop => pop(allocator, input),
|
||||||
@ -50,6 +49,7 @@ fn pop(allocator: std.mem.Allocator, input: *zid.Data) !void {
|
|||||||
},
|
},
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
} else {
|
} else {
|
||||||
|
try updated_array.appendNTimes(' ', 8);
|
||||||
new_len = 0;
|
new_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user