Prefer rb_fstring_lit over rb_fstring_cstr

The former states explicitly that the argument must be a literal,
and can optimize away `strlen` on all compilers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-10-13 09:59:22 +00:00
parent 83a01e6f52
commit fa8b08b424
13 changed files with 37 additions and 39 deletions

View file

@ -826,7 +826,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
args[0] = INT2FIX(precision);
args[1] = subsec;
result = rb_str_format(2, args,
rb_fstring_cstr("%0*d"));
rb_fstring_lit("%0*d"));
(void)strlcpy(s, StringValueCStr(result), endp-s);
s += precision;
}