diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:07:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-04 23:07:26 -0300 |
| commit | 398270fb7e121cbaab9e264a39bc83b5d32c40c7 (patch) | |
| tree | 3b1be9a8d97874ede9e62ecb4d0ac42ff3aa1329 /src/hunks.zig | |
| parent | cdbb06a5de858a721bdbfa127ea839f791b0dc24 (diff) | |
| download | pardes-398270fb7e121cbaab9e264a39bc83b5d32c40c7.tar.gz pardes-398270fb7e121cbaab9e264a39bc83b5d32c40c7.zip | |
locations: one appendRow copies a row's path and colours onto a list being built, for appendMetadata, hunks' Out.row and Query's writeRow, which each copied, appended and freed on failure by hand
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/hunks.zig')
| -rw-r--r-- | src/hunks.zig | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/hunks.zig b/src/hunks.zig index 8cd5c43a..ae7b5966 100644 --- a/src/hunks.zig +++ b/src/hunks.zig @@ -125,21 +125,16 @@ const Out = struct { /// One row: its text, a newline, and its metadata. fn row(out: *Out, text: []const u8, path: []const u8, meta: Meta) !void { - const gpa = out.p.gpa; try out.text.writer.writeAll(text); try out.text.writer.writeByte('\n'); - const owned_path = try gpa.dupe(u8, path); - errdefer gpa.free(owned_path); - const colors = try gpa.dupe(u8, meta.colors); - errdefer gpa.free(colors); - try out.rows.append(gpa, .{ + try locations.appendRow(out.p.gpa, &out.rows, .{ .kind = meta.kind, .declaration = meta.declaration, - .path = owned_path, + .path = @constCast(path), .at = meta.at, .location_end = meta.location_end, .code_start = meta.code_start, - .colors = colors, + .colors = @constCast(meta.colors), }); } }; |
