Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions mrbgems/mruby-sprintf/src/sprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,15 +618,9 @@ mrb_str_format(mrb_state *mrb, mrb_int argc, const mrb_value *argv, mrb_value fm
mark_written_bytes(result, str);
len = RSTRING_LEN(str);

/* Update result string length for embedded strings */
if (RSTRING(result)->flags & MRB_STR_EMBED) {
mrb_int tmp_n = len;
RSTRING(result)->flags &= ~MRB_STR_EMBED_LEN_MASK;
RSTRING(result)->flags |= tmp_n << MRB_STR_EMBED_LEN_SHIFT;
}
else {
RSTRING(result)->as.heap.len = blen;
}
/* Keep the result's length at what has been written into it, which
CHECK() leaves at the size of the whole buffer. */
RSTR_SET_LEN(mrb_str_ptr(result), blen);

/* Handle precision and width formatting */
if (flags&(FPREC|FWIDTH)) {
Expand Down
Loading