From 2d1beef44a1c7735de63749950d74afa0aa6203f Mon Sep 17 00:00:00 2001
From: Robby Zambito <contact@robbyzambito.me>
Date: Thu, 3 Apr 2025 11:28:25 -0400
Subject: Small cleanup

Rename allocator to gpa (general purpose allocator) and move DebugAllocator type out of main
---
 src/main.zig | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/main.zig')

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");
-- 
cgit