From feffdff4094ea3927eb3880b46b65e700f1e86fb Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Wed, 13 Dec 2023 08:53:06 +0100 Subject: Remove the default allocator from `ParseOptions` fixes #111 --- example/usage.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'example/usage.zig') diff --git a/example/usage.zig b/example/usage.zig index 333536b..a773dd2 100644 --- a/example/usage.zig +++ b/example/usage.zig @@ -2,6 +2,9 @@ const clap = @import("clap"); const std = @import("std"); pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const params = comptime clap.parseParamsComptime( \\-h, --help Display this help and exit. \\-v, --version Output version information and exit. @@ -9,7 +12,9 @@ pub fn main() !void { \\ ); - var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); + var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ + .allocator = gpa.allocator(), + }); defer res.deinit(); // `clap.usage` is a function that can print a simple help message. It can print any `Param` -- cgit v1.2.3