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(...@@ -137,7 +137,7 @@ pub fn genHtml(
137 );137 );
138138
139 const source = try src.getSource(allocator);139 const source = try src.getSource(allocator);
140 try tokenizeAndPrintRaw(allocator, out, source.bytes);140 try tokenizeAndPrintRaw(out, source.bytes);
141 try out.writeAll(141 try out.writeAll(
142 \\</body>142 \\</body>
143 \\</html>143 \\</html>
...@@ -150,13 +150,9 @@ const end_line = "</span>\n";...@@ -150,13 +150,9 @@ const end_line = "</span>\n";
150var line_counter: usize = 1;150var line_counter: usize = 1;
151151
152pub fn tokenizeAndPrintRaw(152pub fn tokenizeAndPrintRaw(
153 allocator: Allocator,
154 out: anytype,153 out: anytype,
155 raw_src: [:0]const u8,154 src: [:0]const u8,
156) !void {155) !void {
157 const src = try allocator.dupeZ(u8, raw_src);
158 defer allocator.free(src);
159
160 line_counter = 1;156 line_counter = 1;
161157
162 try out.print("<pre><code>" ++ start_line, .{line_counter});158 try out.print("<pre><code>" ++ start_line, .{line_counter});