ref: rename gpa usages to the aliased DebugAllocator

This commit is contained in:
2025-06-11 20:31:41 +02:00
parent 76f708d9d7
commit 825fb63bc8
13 changed files with 17 additions and 14 deletions

View File

@@ -124,7 +124,7 @@ const MouseDraw = struct {
pub fn main() !void {
errdefer |err| log.err("Application Error: {any}", .{err});
var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
var gpa: std.heap.DebugAllocator(.{}) = .init;
defer if (gpa.deinit() == .leak) log.err("memory leak", .{});
const allocator = gpa.allocator();
@@ -191,7 +191,10 @@ pub fn main() !void {
.key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) app.quit(),
.accept => |input| {
defer allocator.free(input);
log.info("Accepted input {any}", .{input});
var string = try allocator.alloc(u8, input.len);
defer allocator.free(string);
for (0.., input) |i, char| string[i] = @intCast(char);
log.debug("Accepted input '{s}'", .{string});
},
.err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }),
else => {},