diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-17 00:55:55 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-17 00:55:55 +0000 |
commit | 9eb94b4dc1e6cb21c80b2dfa930bc522a85414ec (patch) | |
tree | 2096dc0f1d95292c473adfc48a811873a70ea68f /strftime.c | |
parent | 312ac7f0a1d973cf846187ac2119a86901f115ea (diff) | |
download | ruby-9eb94b4dc1e6cb21c80b2dfa930bc522a85414ec.tar.gz |
deduplicate static rb_str_format format strings
Anybody who hits these code paths can hit them again in the
future, so try deduplicating across multiple runs of these
methods to reduce garbage.
* string.c (str_upto_each): fstring on "%.*d"
* strftime.c (rb_strftime_with_timespec): fstring on "%0*d"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/strftime.c b/strftime.c index 42e733818c..dbb593ae1e 100644 --- a/strftime.c +++ b/strftime.c @@ -820,7 +820,8 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, VALUE args[2], result; args[0] = INT2FIX(precision); args[1] = subsec; - result = rb_str_format(2, args, rb_str_new2("%0*d")); + result = rb_str_format(2, args, + rb_fstring_cstr("%0*d")); (void)strlcpy(s, StringValueCStr(result), endp-s); s += precision; } |