aboutsummaryrefslogtreecommitdiff
path: root/src/eval/blocks.zig
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-04-27 17:45:13 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2026-04-27 17:45:13 +0200
commit3b0e9424a66058da82d11d432da886ec7b6ce7eb (patch)
tree0ad906e3b7d945405cdfeb9ff95b02546e1ed4bb /src/eval/blocks.zig
parentef5c0341ca15f6862294802103b02992b29609e8 (diff)
perf(eval): reduce memory syscall
Diffstat (limited to 'src/eval/blocks.zig')
-rw-r--r--src/eval/blocks.zig26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/eval/blocks.zig b/src/eval/blocks.zig
index 63a8f12..63c0291 100644
--- a/src/eval/blocks.zig
+++ b/src/eval/blocks.zig
@@ -16,18 +16,7 @@ pub const Code = struct {
}
pub fn element(self: *Self) Element {
- return .{ .ptr = self, .vtable = .{ .deinit = destroy, .html = Self.html } };
- }
-
- pub fn deinit(self: *Self, alloc: Allocator) void {
- destroy(self, alloc);
- }
-
- fn destroy(context: *anyopaque, alloc: Allocator) void {
- var self: *Self = @ptrCast(@alignCast(context));
- for (self.content.items) |it| it.deinit(alloc);
- self.content.deinit(alloc);
- alloc.destroy(self);
+ return .{ .ptr = self, .vtable = .{ .html = Self.html } };
}
fn html(context: *anyopaque, alloc: Allocator) HTML.Error!HTML {
@@ -54,18 +43,7 @@ pub const Figure = struct {
}
pub fn element(self: *Self) Element {
- return .{ .ptr = self, .vtable = .{ .deinit = destroy, .html = Self.html } };
- }
-
- pub fn deinit(self: *Self, alloc: Allocator) void {
- destroy(self, alloc);
- }
-
- fn destroy(context: *anyopaque, alloc: Allocator) void {
- const self: *Self = @ptrCast(@alignCast(context));
- self.content.deinit(alloc);
- if (self.caption) |cap| cap.deinit(alloc);
- alloc.destroy(self);
+ return .{ .ptr = self, .vtable = .{ .html = Self.html } };
}
fn html(context: *anyopaque, alloc: Allocator) HTML.Error!HTML {