aboutsummaryrefslogtreecommitdiff
path: root/src/eval/list.zig
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-04-28 15:08:02 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2026-04-28 15:08:02 +0200
commit3b1e6547d069d7c438af551a4989972802a895ee (patch)
tree7c32e8fcac432539888e0cdb598f495316b0772d /src/eval/list.zig
parente154408e8ddeaee83242002f4c7af68b29d3a677 (diff)
perf(html): reduce memory usage
Diffstat (limited to 'src/eval/list.zig')
-rw-r--r--src/eval/list.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/eval/list.zig b/src/eval/list.zig
index 06b7af7..2ba136a 100644
--- a/src/eval/list.zig
+++ b/src/eval/list.zig
@@ -21,13 +21,15 @@ fn List(comptime tag: []const u8) type {
return .{ .ptr = self, .vtable = .{ .html = html } };
}
- fn html(context: *anyopaque, alloc: Allocator) HTML.Error!HTML {
+ fn html(context: *anyopaque, alloc: Allocator) HTML.Error!HTML {
const self: *Self = @ptrCast(@alignCast(context));
var el = try HTML.Content.init(alloc, tag);
+ var root = try HTML.Root.init(alloc);
+ el.content = root.element();
for (self.content.items) |it| {
- var li = try HTML.Content.init(alloc, "li");
- try li.append(try it.html(alloc));
- try el.append(li.element());
+ var li = try HTML.Content.init(root.allocator(), "li");
+ li.content = try it.html(root.allocator());
+ root.append(li.element());
}
return el.element();
}