args now use a fixed stack buffer instead of using pages
This commit is contained in:
parent
b5e1b15f8c
commit
f34f0ff465
1 changed files with 8 additions and 5 deletions
13
src/main.zig
13
src/main.zig
|
@ -37,7 +37,10 @@ inline fn get_n_jobs(arg: [:0]const u8) !usize {
|
|||
return n;
|
||||
}
|
||||
|
||||
fn get_opts(alloc: std.mem.Allocator) !util.Options {
|
||||
fn get_opts() !util.Options {
|
||||
var buff: [100]u8 = undefined;
|
||||
var fba = std.heap.FixedBufferAllocator.init(&buff);
|
||||
var alloc = fba.allocator();
|
||||
var args = try std.process.argsWithAllocator(alloc);
|
||||
defer args.deinit();
|
||||
_ = args.next();
|
||||
|
@ -51,10 +54,10 @@ fn get_opts(alloc: std.mem.Allocator) !util.Options {
|
|||
}
|
||||
|
||||
pub fn main() !void {
|
||||
var arg_buff: [100]u8 = undefined;
|
||||
var arg_fba = std.heap.FixedBufferAllocator.init(&arg_buff);
|
||||
const alloc = arg_fba.allocator();
|
||||
const opts = get_opts();
|
||||
|
||||
const opts = try get_opts(alloc);
|
||||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
std.debug.print("{any}\n", .{opts});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue