Skip to content

Commit c5eb124

Browse files
nobubyroot
authored andcommitted
Reduce an unnecessary intermediate string
1 parent 398340f commit c5eb124

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

ext/json/ext/parser/parser.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,8 @@ static VALUE build_parse_error_message(const char *format, JSON_ParserState *sta
436436
}
437437
}
438438

439-
VALUE msg = rb_sprintf(format, ptr);
440-
VALUE message = rb_enc_sprintf(enc_utf8, "%s at line %ld column %ld", RSTRING_PTR(msg), line, column);
441-
RB_GC_GUARD(msg);
439+
VALUE message = rb_enc_sprintf(enc_utf8, format, ptr);
440+
rb_str_catf(message, " at line %ld column %ld", line, column);
442441
return message;
443442
}
444443

0 commit comments

Comments
 (0)