summaryrefslogtreecommitdiff
path: root/src/hunks.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/hunks.zig')
-rw-r--r--src/hunks.zig11
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),
});
}
};