From 87e5daf9156583072d9ccb9ff0fa074f65fa6836 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Fri, 17 Apr 2026 18:07:11 +0200 Subject: style(): rename alloc into gpa --- src/dom/html.zig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/dom/html.zig') diff --git a/src/dom/html.zig b/src/dom/html.zig index bf62fbb..4b39a3f 100644 --- a/src/dom/html.zig +++ b/src/dom/html.zig @@ -24,9 +24,9 @@ pub fn escape(gpa: std.mem.Allocator, v: []const u8) ![]const u8 { return acc.toOwnedSlice(gpa); } -fn doTest(alloc: std.mem.Allocator, el: []const u8, exp: []const u8) !void { - const got = try escape(alloc, el); - defer alloc.free(got); +fn doTest(gpa: std.mem.Allocator, el: []const u8, exp: []const u8) !void { + const got = try escape(gpa, el); + defer gpa.free(got); std.testing.expect(eql(u8, got, exp)) catch |err| { std.debug.print("{s}\n", .{got}); return err; @@ -36,12 +36,12 @@ fn doTest(alloc: std.mem.Allocator, el: []const u8, exp: []const u8) !void { test "escaping html" { var arena = std.heap.DebugAllocator(.{}).init; defer _ = arena.deinit(); - const alloc = arena.allocator(); + const gpa = arena.allocator(); - try doTest(alloc, "hello world", "hello world"); - try doTest(alloc, "hello&world", "hello&world"); - try doTest(alloc, "hello'world", "hello'world"); - try doTest(alloc, "helloworld", "hello>world"); - try doTest(alloc, "hello\"world", "hello"world"); + try doTest(gpa, "hello world", "hello world"); + try doTest(gpa, "hello&world", "hello&world"); + try doTest(gpa, "hello'world", "hello'world"); + try doTest(gpa, "helloworld", "hello>world"); + try doTest(gpa, "hello\"world", "hello"world"); } -- cgit v1.2.3