File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -43,15 +43,6 @@ pub const std_options = .{
4343};
4444
4545pub fn main () ! void {
46- var mem : [4096 ]u8 = undefined ;
47- var fba = std .heap .FixedBufferAllocator .init (& mem );
48- const args = try parseArgs (fba .allocator ());
49-
50- if (args .mode == .help ) {
51- // don't need to create a gpa in this case
52- return args .printUsageAndExit (args .mode .help );
53- }
54-
5546 // allocator
5647 // - in Debug mode we use the General Purpose Allocator to detect memory leaks
5748 // - in Release mode we use the c allocator
@@ -62,8 +53,12 @@ pub fn main() !void {
6253 _ = gpa .detectLeaks ();
6354 };
6455
56+ var args_arena = std .heap .ArenaAllocator .init (alloc );
57+ defer args_arena .deinit ();
58+ const args = try parseArgs (args_arena .allocator ());
59+
6560 switch (args .mode ) {
66- .help = > unreachable , // handled above
61+ .help = > args . printUsageAndExit ( args . mode . help ),
6762 .serve = > | opts | {
6863 const address = std .net .Address .parseIp4 (opts .host , opts .port ) catch | err | {
6964 log .err ("address (host:port) {any}\n " , .{err });
You can’t perform that action at this time.
0 commit comments