diff options
| author | 2020-11-01 05:11:01 -0800 | |
|---|---|---|
| committer | 2020-11-01 14:11:01 +0100 | |
| commit | 44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0 (patch) | |
| tree | 982742ca805e4f9039bb6be491c41c9a4c90facf /clap/args.zig | |
| parent | adjust examples, README template (diff) | |
| download | zig-clap-44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0.tar.gz zig-clap-44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0.tar.xz zig-clap-44ee31e4bc2ec663f12e7c7d870f8db7c9de39d0.zip | |
use null sentinel in OsIterator (#27)
Diffstat (limited to 'clap/args.zig')
| -rw-r--r-- | clap/args.zig | 4 |
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 { |