Changes
2 changed files (+12/-7)
-
-
@@ -43,14 +43,14 @@ };// Executable { const calloc = b.option( const memcheck = b.option( bool, "calloc", "Use libc allocator, to inspect allocations using Valgrind", "memcheck", "Enable memory checking. This option also enables support for Valgrind's memcheck.", ) orelse false; const options = b.addOptions(); options.addOption(bool, "calloc", calloc); options.addOption(bool, "memcheck", memcheck); const exe = b.addExecutable(.{ .name = "plac",
-
@@ -65,7 +65,7 @@ exe.root_module.addImport("core", core);exe.root_module.addImport("clap", clap); exe.root_module.addOptions("build_config", options); if (calloc) { if (memcheck) { exe.linkLibC(); }
-
-
-
@@ -44,11 +44,16 @@ );pub fn main() !u8 { var arena = std.heap.ArenaAllocator.init( if (build_config.calloc) std.heap.c_allocator else std.heap.page_allocator, if (build_config.memcheck) std.heap.c_allocator else std.heap.page_allocator, ); defer arena.deinit(); const allocator = arena.allocator(); const allocator = if (build_config.memcheck) alloc: { var da = std.heap.DebugAllocator(.{ .safety = true }){ .backing_allocator = arena.allocator(), }; break :alloc da.allocator(); } else arena.allocator(); var iter = try std.process.ArgIterator.initWithAllocator(allocator); defer iter.deinit();
-