aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-24 13:38:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-24 13:38:20 +0000
commit20215f0181fd6124e927ab28d25610626fe43221 (patch)
tree11144b7fa2d2827615c316ce19fa9a56083f80c7
parent743f2bf879bf1f49d0c26867827b5f1db050f315 (diff)
downloadruby-20215f0181fd6124e927ab28d25610626fe43221.tar.gz
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
-rw-r--r--ChangeLog10
-rw-r--r--strftime.c4
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 58cdbc2a06..6788e4ae20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Mar 24 22:38:18 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c (FMT, FMTV): remove recursive-assignments to get rid
+ of undefined behavior. [ruby-core:74532] [Bug #12213]
+
+Thu Mar 24 22:38:05 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c (FMT, FMTV): remove recursive-assignments to get rid
+ of undefined behavior. [ruby-core:74532] [Bug #12213]
+
Thu Mar 24 17:44:02 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* strftime.c (FMT_PADDING): extract format for padding.
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); \