ruby-changes:61469
From: Nobuyoshi <ko1@a...>
Date: Wed, 3 Jun 2020 19:20:02 +0900 (JST)
Subject: [ruby-changes:61469] ee35a4dad3 (master): Append subsec part instead of creating new string
https://git.ruby-lang.org/ruby.git/commit/?id=ee35a4dad3 From ee35a4dad30eaf74064d5c38bfdfb3550998bb8f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 3 Jun 2020 12:42:47 +0900 Subject: Append subsec part instead of creating new string diff --git a/time.c b/time.c index da8feb7..ddd011e 100644 --- a/time.c +++ b/time.c @@ -4145,7 +4145,7 @@ time_inspect(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L4145 } else if (FIXNUM_P(subsec) && FIX2LONG(subsec) < TIME_SCALE) { long len; - str = rb_enc_sprintf(rb_usascii_encoding(), "%"PRIsVALUE".%09ld", str, FIX2LONG(subsec)); + rb_str_catf(str, ".%09ld", FIX2LONG(subsec)); for (len=RSTRING_LEN(str); RSTRING_PTR(str)[len-1] == '0' && len > 0; len--) ; rb_str_resize(str, len); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/