diff options
author | Robby Zambito <contact@robbyzambito.me> | 2025-04-03 11:28:25 -0400 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2025-04-03 11:29:44 -0400 |
commit | 8dc3e5d9490f07061d3343a2968be5c94c4895c5 (patch) | |
tree | bc97b3e384b5dc938c4e73b1bac77dc528905248 /src/main.zig | |
parent | 0d8155f0af3e67bba08ccbed4b254909721a6aa3 (diff) |
Small cleanup
Rename allocator to gpa (general purpose allocator) and move DebugAllocator type out of main
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig index fd77d30..1de51f4 100644 --- a/src/main.zig +++ b/src/main.zig @@ -64,13 +64,12 @@ const SaprusMessage = union(SaprusPacketType) { }; pub fn main() !void { - const DBA = std.heap.DebugAllocator(.{}); - var dba: ?DBA = if (comptime is_debug) DBA.init else null; + var dba: ?DebugAllocator = if (comptime is_debug) DebugAllocator.init else null; defer if (dba) |*d| { _ = d.deinit(); }; - var allocator = if (dba) |*d| d.allocator() else std.heap.smp_allocator; + var gpa = if (dba) |*d| d.allocator() else std.heap.smp_allocator; const msg = SaprusMessage{ .relay = .{ @@ -79,8 +78,8 @@ pub fn main() !void { }, }; - const msg_bytes = try msg.toBytes(allocator); - defer allocator.free(msg_bytes); + const msg_bytes = try msg.toBytes(gpa); + defer gpa.free(msg_bytes); try network.init(); defer network.deinit(); @@ -109,5 +108,6 @@ pub fn main() !void { const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; +const DebugAllocator = std.heap.DebugAllocator(.{}); const network = @import("network"); |