std.fmt: remove placeholders from binary

This commit is contained in:
rpkak 2025-01-06 12:06:52 +01:00 committed by Isaac Freund
parent d4c85079c5
commit 34644511bb

View File

@ -99,7 +99,8 @@ pub fn format(
@setEvalBranchQuota(2000000);
comptime var arg_state: ArgState = .{ .args_len = fields_info.len };
comptime var i = 0;
inline while (i < fmt.len) {
comptime var literal: []const u8 = "";
inline while (true) {
const start_index = i;
inline while (i < fmt.len) : (i += 1) {
@ -121,14 +122,17 @@ pub fn format(
i += 2;
}
// Write out the literal
if (start_index != end_index) {
try writer.writeAll(fmt[start_index..end_index]);
}
literal = literal ++ fmt[start_index..end_index];
// We've already skipped the other brace, restart the loop
if (unescape_brace) continue;
// Write out the literal
if (literal.len != 0) {
try writer.writeAll(literal);
literal = "";
}
if (i >= fmt.len) break;
if (fmt[i] == '}') {