aboutsummaryrefslogtreecommitdiff
path: root/src/paragraph.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/paragraph.zig
parentef5c0341ca15f6862294802103b02992b29609e8 (diff)
perf(eval): reduce memory syscall
Diffstat (limited to 'src/paragraph.zig')
-rw-r--r--src/paragraph.zig14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/paragraph.zig b/src/paragraph.zig
index b50b2ec..e1a01cf 100644
--- a/src/paragraph.zig
+++ b/src/paragraph.zig
@@ -15,7 +15,6 @@ pub const Error = content.Error || link.Error || Allocator.Error;
pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
var el = try Paragraph.Block.init(alloc);
- errdefer el.deinit(alloc);
while (l.peek()) |next| switch (next.kind) {
.strong_delimiter => return el.element(),
.weak_delimiter => {
@@ -31,19 +30,10 @@ pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
pub fn parseLine(alloc: Allocator, l: *Lexer) Error!Element {
var line = try Element.Empty.init(alloc);
- errdefer line.deinit(alloc);
while (l.peek()) |next| switch (next.kind) {
.weak_delimiter, .strong_delimiter => return line.element(),
- .link => {
- var el = try link.parse(alloc, l);
- errdefer el.deinit(alloc);
- try line.content.append(alloc, el);
- },
- else => {
- var el = try content.parse(alloc, l);
- errdefer el.deinit(alloc);
- try line.content.append(alloc, el);
- },
+ .link => try line.content.append(alloc, try link.parse(alloc, l)),
+ else => try line.content.append(alloc, try content.parse(alloc, l)),
};
return line.element();
}