authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-04-25 20:22:48 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-04-25 20:22:48 -07:00
logbd487677bda80ecd701a7ab8ce9a2347bfbf5995
treed0b9bd648bb1490db33b3886457c5212ed0c8f3c
parenta74468be60283e66e9b20388372394b54219d6b0

add nullifyS


1 files changed, 6 insertions(+), 0 deletions(-)

src/lib.zig+6
...@@ -457,3 +457,9 @@ pub fn readFile(dir: std.fs.Dir, sub_path: string, alloc: std.mem.Allocator) !st...@@ -457,3 +457,9 @@ pub fn readFile(dir: std.fs.Dir, sub_path: string, alloc: std.mem.Allocator) !st
457 pipe(file.reader(), buffer.writer()) catch @panic("unreachable"); // did the filesystem lie?457 pipe(file.reader(), buffer.writer()) catch @panic("unreachable"); // did the filesystem lie?
458 return buffer.items;458 return buffer.items;
459}459}
460
461pub fn nullifyS(s: ?string) ?string {
462 if (s == null) return null;
463 if (s.?.len == 0) return null;
464 return s.?;
465}