authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-09-10 17:31:15+02:00
committergravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-09-10 17:31:42+02:00
log81939a4939638fb296bc874afcef2f0f141f5c0c
tree8ce7ee0d231d6237b4cb1ce03470bdefb4dba40f
parent4fd4c733d4676ee50667ca895259b277966f15c6

autodoc: remove unnecessary string copy


1 files changed, 2 insertions(+), 6 deletions(-)

src/autodoc/render_source.zig+2-6
......@@ -137,7 +137,7 @@ pub fn genHtml(
137137 );
138138
139139 const source = try src.getSource(allocator);
140 try tokenizeAndPrintRaw(allocator, out, source.bytes);
140 try tokenizeAndPrintRaw(out, source.bytes);
141141 try out.writeAll(
142142 \\</body>
143143 \\</html>
......@@ -150,13 +150,9 @@ const end_line = "</span>\n";
150150var line_counter: usize = 1;
151151
152152pub fn tokenizeAndPrintRaw(
153 allocator: Allocator,
154153 out: anytype,
155 raw_src: [:0]const u8,
154 src: [:0]const u8,
156155) !void {
157 const src = try allocator.dupeZ(u8, raw_src);
158 defer allocator.free(src);
159
160156 line_counter = 1;
161157
162158 try out.print("<pre><code>" ++ start_line, .{line_counter});