diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-28 15:08:02 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-28 15:08:02 +0200 |
| commit | 3b1e6547d069d7c438af551a4989972802a895ee (patch) | |
| tree | 7c32e8fcac432539888e0cdb598f495316b0772d /src/eval/Element.zig | |
| parent | e154408e8ddeaee83242002f4c7af68b29d3a677 (diff) | |
perf(html): reduce memory usage
Diffstat (limited to 'src/eval/Element.zig')
| -rw-r--r-- | src/eval/Element.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/eval/Element.zig b/src/eval/Element.zig index f93dc1a..d804a0c 100644 --- a/src/eval/Element.zig +++ b/src/eval/Element.zig @@ -48,7 +48,7 @@ pub const Empty = struct { const self: *Self = @ptrCast(@alignCast(context)); var el = try HTML.Root.init(alloc); errdefer el.deinit(); - for (self.content.items) |it| try el.append(try it.html(el.allocator())); + for (self.content.items) |it| el.append(try it.html(el.allocator())); return el.element(); } }; @@ -111,7 +111,9 @@ pub fn Simple(comptime tag: []const u8) type { fn html(context: *anyopaque, alloc: Allocator) HTML.Error!HTML { const self: *Self = @ptrCast(@alignCast(context)); var el = try HTML.Content.init(alloc, tag); - for (self.content.items) |it| try el.append(try it.html(alloc)); + var root = try HTML.Root.init(alloc); + el.content = root.element(); + for (self.content.items) |it| root.append(try it.html(root.allocator())); return el.element(); } }; |
