summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthew Knight2020-11-01 05:11:01 -0800
committerGravatar GitHub2020-11-01 14:11:01 +0100
commit44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0 (patch)
tree982742ca805e4f9039bb6be491c41c9a4c90facf
parentadjust examples, README template (diff)
downloadzig-clap-44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0.tar.gz
zig-clap-44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0.tar.xz
zig-clap-44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0.zip
use null sentinel in OsIterator (#27)
-rw-r--r--clap/args.zig4
1 files 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 {
53 /// The executable path (this is the first argument passed to the program) 53 /// The executable path (this is the first argument passed to the program)
54 /// TODO: Is it the right choice for this to be null? Maybe `init` should 54 /// TODO: Is it the right choice for this to be null? Maybe `init` should
55 /// return an error when we have no exe. 55 /// return an error when we have no exe.
56 exe_arg: ?[]const u8, 56 exe_arg: ?[:0]const u8,
57 57
58 pub fn init(allocator: *mem.Allocator) Error!OsIterator { 58 pub fn init(allocator: *mem.Allocator) Error!OsIterator {
59 var res = OsIterator{ 59 var res = OsIterator{
@@ -69,7 +69,7 @@ pub const OsIterator = struct {
69 iter.arena.deinit(); 69 iter.arena.deinit();
70 } 70 }
71 71
72 pub fn next(iter: *OsIterator) Error!?[]const u8 { 72 pub fn next(iter: *OsIterator) Error!?[:0]const u8 {
73 if (builtin.os.tag == .windows) { 73 if (builtin.os.tag == .windows) {
74 return try iter.args.next(&iter.arena.allocator) orelse return null; 74 return try iter.args.next(&iter.arena.allocator) orelse return null;
75 } else { 75 } else {