From 9eb94b4dc1e6cb21c80b2dfa930bc522a85414ec Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 17 Mar 2017 00:55:55 +0000 Subject: 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 --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 1bfdd00e48..4c6fe2b5f9 100644 --- a/string.c +++ b/string.c @@ -4147,7 +4147,7 @@ str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE a } else { ID op = excl ? '<' : idLE; - VALUE args[2], fmt = rb_obj_freeze(rb_usascii_str_new_cstr("%.*d")); + VALUE args[2], fmt = rb_fstring_cstr("%.*d"); args[0] = INT2FIX(width); while (rb_funcall(b, op, 1, e)) { -- cgit v1.2.3