authorgravatar for rpkak@noreply.codeberg.orgrpkak <rpkak@noreply.codeberg.org> 2025-01-06 12:06:52+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2025-02-10 22:52:17+01:00
log34644511bb6d83aa6575641ef79e5eefb495e3e1
treeeb348b5725d876173154a3bc7cf8633c10b503e2
parentd4c85079c5796805e6f44cadaee618468267db63

std.fmt: remove placeholders from binary


1 files changed, 9 insertions(+), 5 deletions(-)

lib/std/fmt.zig+9-5
......@@ -99,7 +99,8 @@ pub fn format(
9999 @setEvalBranchQuota(2000000);
100100 comptime var arg_state: ArgState = .{ .args_len = fields_info.len };
101101 comptime var i = 0;
102 inline while (i < fmt.len) {
102 comptime var literal: []const u8 = "";
103 inline while (true) {
103104 const start_index = i;
104105
105106 inline while (i < fmt.len) : (i += 1) {
......@@ -121,14 +122,17 @@ pub fn format(
121122 i += 2;
122123 }
123124
124 // Write out the literal
125 if (start_index != end_index) {
126 try writer.writeAll(fmt[start_index..end_index]);
127 }
125 literal = literal ++ fmt[start_index..end_index];
128126
129127 // We've already skipped the other brace, restart the loop
130128 if (unescape_brace) continue;
131129
130 // Write out the literal
131 if (literal.len != 0) {
132 try writer.writeAll(literal);
133 literal = "";
134 }
135
132136 if (i >= fmt.len) break;
133137
134138 if (fmt[i] == '}') {