From 44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0 Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Sun, 1 Nov 2020 05:11:01 -0800 Subject: [PATCH] use null sentinel in OsIterator (#27) --- clap/args.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clap/args.zig b/clap/args.zig index 0141d86..4d97017 100644 --- a/clap/args.zig +++ b/clap/args.zig @@ -53,7 +53,7 @@ pub const OsIterator = struct { /// The executable path (this is the first argument passed to the program) /// TODO: Is it the right choice for this to be null? Maybe `init` should /// return an error when we have no exe. - exe_arg: ?[]const u8, + exe_arg: ?[:0]const u8, pub fn init(allocator: *mem.Allocator) Error!OsIterator { var res = OsIterator{ @@ -69,7 +69,7 @@ pub const OsIterator = struct { iter.arena.deinit(); } - pub fn next(iter: *OsIterator) Error!?[]const u8 { + pub fn next(iter: *OsIterator) Error!?[:0]const u8 { if (builtin.os.tag == .windows) { return try iter.args.next(&iter.arena.allocator) orelse return null; } else {