diff options
author | Rutger Broekhoff | 2021-07-02 22:00:49 +0200 |
---|---|---|
committer | Rutger Broekhoff | 2021-07-02 22:00:49 +0200 |
commit | ce7129c829c64ef9bec465f11f50311e487b61c1 (patch) | |
tree | 9f69f6f33d5285e9a1b02873cc493a186ca3d7e4 /tool/znk.zig | |
parent | 78930ad50faa446a5fbed2baad2969933bee1bd3 (diff) | |
download | zig-nkeys-ce7129c829c64ef9bec465f11f50311e487b61c1.tar.gz zig-nkeys-ce7129c829c64ef9bec465f11f50311e487b61c1.zip |
Remove unused parameters and variables in znk
Diffstat (limited to 'tool/znk.zig')
-rw-r--r-- | tool/znk.zig | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tool/znk.zig b/tool/znk.zig index 974a620..0a4b764 100644 --- a/tool/znk.zig +++ b/tool/znk.zig | |||
@@ -46,10 +46,10 @@ pub fn main() anyerror!void { | |||
46 | const arena = &arena_instance.allocator; | 46 | const arena = &arena_instance.allocator; |
47 | 47 | ||
48 | const args = try process.argsAlloc(arena); | 48 | const args = try process.argsAlloc(arena); |
49 | return mainArgs(gpa, arena, args); | 49 | return mainArgs(arena, args); |
50 | } | 50 | } |
51 | 51 | ||
52 | pub fn mainArgs(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void { | 52 | pub fn mainArgs(arena: *Allocator, args: []const []const u8) !void { |
53 | if (args.len <= 1) { | 53 | if (args.len <= 1) { |
54 | info("{s}", .{usage}); | 54 | info("{s}", .{usage}); |
55 | fatal("expected command argument", .{}); | 55 | fatal("expected command argument", .{}); |
@@ -58,11 +58,11 @@ pub fn mainArgs(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v | |||
58 | const cmd = args[1]; | 58 | const cmd = args[1]; |
59 | const cmd_args = args[2..]; | 59 | const cmd_args = args[2..]; |
60 | if (mem.eql(u8, cmd, "gen")) { | 60 | if (mem.eql(u8, cmd, "gen")) { |
61 | return cmdGen(gpa, arena, cmd_args); | 61 | return cmdGen(arena, cmd_args); |
62 | } else if (mem.eql(u8, cmd, "sign")) { | 62 | } else if (mem.eql(u8, cmd, "sign")) { |
63 | return cmdSign(gpa, arena, cmd_args); | 63 | return cmdSign(arena, cmd_args); |
64 | } else if (mem.eql(u8, cmd, "verify")) { | 64 | } else if (mem.eql(u8, cmd, "verify")) { |
65 | return cmdVerify(gpa, arena, cmd_args); | 65 | return cmdVerify(arena, cmd_args); |
66 | } else if (mem.eql(u8, cmd, "version")) { | 66 | } else if (mem.eql(u8, cmd, "version")) { |
67 | return io.getStdOut().writeAll(build_options.version ++ "\n"); | 67 | return io.getStdOut().writeAll(build_options.version ++ "\n"); |
68 | } else if (mem.eql(u8, cmd, "help") or mem.eql(u8, cmd, "-h") or mem.eql(u8, cmd, "--help")) { | 68 | } else if (mem.eql(u8, cmd, "help") or mem.eql(u8, cmd, "-h") or mem.eql(u8, cmd, "--help")) { |
@@ -96,7 +96,7 @@ const usage_gen = | |||
96 | \\ | 96 | \\ |
97 | ; | 97 | ; |
98 | 98 | ||
99 | pub fn cmdGen(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void { | 99 | pub fn cmdGen(arena: *Allocator, args: []const []const u8) !void { |
100 | const stdin = io.getStdIn(); | 100 | const stdin = io.getStdIn(); |
101 | const stdout = io.getStdOut(); | 101 | const stdout = io.getStdOut(); |
102 | 102 | ||
@@ -200,7 +200,7 @@ const usage_sign = | |||
200 | \\ | 200 | \\ |
201 | ; | 201 | ; |
202 | 202 | ||
203 | pub fn cmdSign(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void { | 203 | pub fn cmdSign(arena: *Allocator, args: []const []const u8) !void { |
204 | const stdin = io.getStdIn(); | 204 | const stdin = io.getStdIn(); |
205 | const stdout = io.getStdOut(); | 205 | const stdout = io.getStdOut(); |
206 | 206 | ||
@@ -286,7 +286,7 @@ const usage_verify = | |||
286 | \\ | 286 | \\ |
287 | ; | 287 | ; |
288 | 288 | ||
289 | pub fn cmdVerify(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void { | 289 | pub fn cmdVerify(arena: *Allocator, args: []const []const u8) !void { |
290 | const stdin = io.getStdIn(); | 290 | const stdin = io.getStdIn(); |
291 | const stdout = io.getStdOut(); | 291 | const stdout = io.getStdOut(); |
292 | 292 | ||
@@ -396,7 +396,7 @@ fn PrefixKeyGenerator(comptime EntropyReaderType: type) type { | |||
396 | role: nkeys.Role, | 396 | role: nkeys.Role, |
397 | prefix: []const u8, | 397 | prefix: []const u8, |
398 | allocator: *Allocator, | 398 | allocator: *Allocator, |
399 | done: std.atomic.Bool, | 399 | done: std.atomic.Atomic(bool), |
400 | entropy: ?EntropyReaderType, | 400 | entropy: ?EntropyReaderType, |
401 | 401 | ||
402 | const Self = @This(); | 402 | const Self = @This(); |
@@ -406,7 +406,7 @@ fn PrefixKeyGenerator(comptime EntropyReaderType: type) type { | |||
406 | .role = role, | 406 | .role = role, |
407 | .prefix = prefix, | 407 | .prefix = prefix, |
408 | .allocator = allocator, | 408 | .allocator = allocator, |
409 | .done = std.atomic.Bool.init(false), | 409 | .done = std.atomic.Atomic(bool).init(false), |
410 | .entropy = entropy, | 410 | .entropy = entropy, |
411 | }; | 411 | }; |
412 | } | 412 | } |
@@ -428,7 +428,7 @@ fn PrefixKeyGenerator(comptime EntropyReaderType: type) type { | |||
428 | var public_key = kp.publicKeyText(); | 428 | var public_key = kp.publicKeyText(); |
429 | if (!mem.startsWith(u8, public_key[1..], self.prefix)) continue; | 429 | if (!mem.startsWith(u8, public_key[1..], self.prefix)) continue; |
430 | 430 | ||
431 | if (self.done.xchg(true, .SeqCst)) return; // another thread is already done | 431 | if (self.done.swap(true, .SeqCst)) return; // another thread is already done |
432 | 432 | ||
433 | info("{s}", .{kp.seedText()}); | 433 | info("{s}", .{kp.seedText()}); |
434 | info("{s}", .{public_key}); | 434 | info("{s}", .{public_key}); |