mirror of
https://github.com/zigzap/zap.git
synced 2025-10-21 07:34:08 +00:00
test
This commit is contained in:
parent
0551bcebfb
commit
83220302d7
1 changed files with 2 additions and 2 deletions
|
@ -26,7 +26,7 @@ pub const FreeOrNot = struct {
|
||||||
|
|
||||||
pub fn fio2strAllocOrNot(o: fio.FIOBJ, a: std.mem.Allocator, always_alloc: bool) !FreeOrNot {
|
pub fn fio2strAllocOrNot(o: fio.FIOBJ, a: std.mem.Allocator, always_alloc: bool) !FreeOrNot {
|
||||||
if (o == 0) return .{ .str = "null", .freeme = false };
|
if (o == 0) return .{ .str = "null", .freeme = false };
|
||||||
if (o == fio.FIOBJ_INVALID) return .{ .str = "null", .freeme = false };
|
if (o == fio.FIOBJ_INVALID) return .{ .str = "invalid", .freeme = false };
|
||||||
return switch (fio.fiobj_type(o)) {
|
return switch (fio.fiobj_type(o)) {
|
||||||
fio.FIOBJ_T_TRUE => .{ .str = "true", .freeme = false },
|
fio.FIOBJ_T_TRUE => .{ .str = "true", .freeme = false },
|
||||||
fio.FIOBJ_T_FALSE => .{ .str = "false", .freeme = false },
|
fio.FIOBJ_T_FALSE => .{ .str = "false", .freeme = false },
|
||||||
|
@ -35,7 +35,7 @@ pub fn fio2strAllocOrNot(o: fio.FIOBJ, a: std.mem.Allocator, always_alloc: bool)
|
||||||
fio.FIOBJ_T_FLOAT => .{ .str = try a.dupe(u8, fio2str(o) orelse "null"), .freeme = true, .allocator = a },
|
fio.FIOBJ_T_FLOAT => .{ .str = try a.dupe(u8, fio2str(o) orelse "null"), .freeme = true, .allocator = a },
|
||||||
// the string comes out of the request, so it is safe to not make a copy
|
// the string comes out of the request, so it is safe to not make a copy
|
||||||
fio.FIOBJ_T_STRING => .{ .str = if (always_alloc) try a.dupe(u8, fio2str(o) orelse "") else fio2str(o) orelse "", .freeme = if (always_alloc) true else false, .allocator = a },
|
fio.FIOBJ_T_STRING => .{ .str = if (always_alloc) try a.dupe(u8, fio2str(o) orelse "") else fio2str(o) orelse "", .freeme = if (always_alloc) true else false, .allocator = a },
|
||||||
else => .{ .str = "null", .freeme = false },
|
else => .{ .str = "unknown_type", .freeme = false },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
pub fn str2fio(s: []const u8) fio.fio_str_info_s {
|
pub fn str2fio(s: []const u8) fio.fio_str_info_s {
|
||||||
|
|
Loading…
Add table
Reference in a new issue