From 1691f1fddfdbdf6cda9efab9f1526085398f4e9f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 24 Mar 2016 13:38:20 +0000 Subject: strftime.c: remove recursive-assignments * strftime.c (FMT, FMTV): remove recursive-assignments to get rid of undefined behavior. [ruby-core:74532] [Bug #12213] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- strftime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'strftime.c') diff --git a/strftime.c b/strftime.c index f7f3714c33..2f1888d457 100644 --- a/strftime.c +++ b/strftime.c @@ -287,7 +287,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, (precision <= 0) ? (precision = (def_prec)) : (precision)) #define FMT(def_pad, def_prec, fmt, val) \ do { \ - precision = FMT_PRECISION(def_prec); \ + FMT_PRECISION(def_prec); \ len = s - start; \ NEEDS(precision); \ rb_str_set_len(ftime, len); \ @@ -324,7 +324,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, } \ else { \ const char *fmts = FMT_PADDING(fmt, def_pad); \ - precision = FMT_PRECISION(def_prec); \ + FMT_PRECISION(def_prec); \ tmp = format_value(fmts, tmp, precision); \ rb_str_append(ftime, tmp); \ RSTRING_GETMEM(ftime, s, len); \ -- cgit v1.2.3