Compare commits

...

1 Commits

Author SHA1 Message Date
Jarred Sumner
343b21f5a3 See if estimateLengthForUTF8 costs more than it provides 2025-10-11 18:50:17 -07:00

View File

@@ -341,7 +341,7 @@ pub fn writePreQuotedString(text_in: []const u8, comptime Writer: type, writer:
pub fn quoteForJSON(text: []const u8, bytes: *MutableString, comptime ascii_only: bool) !void {
const writer = bytes.writer();
try bytes.growIfNeeded(estimateLengthForUTF8(text, ascii_only, '"'));
try bytes.growIfNeeded(2 + text.len);
try bytes.appendChar('"');
try writePreQuotedString(text, @TypeOf(writer), writer, '"', ascii_only, true, .utf8);
bytes.appendChar('"') catch unreachable;