ruby-changes:64645
From: Kenta <ko1@a...>
Date: Mon, 28 Dec 2020 21:17:18 +0900 (JST)
Subject: [ruby-changes:64645] 80d9e457c5 (master): [ruby/bigdecimal] Reduce conditional branch count in VpNewVarArg
https://git.ruby-lang.org/ruby.git/commit/?id=80d9e457c5 From 80d9e457c585038bd4ab2d661b074c7d67955649 Mon Sep 17 00:00:00 2001 From: Kenta Murata <mrkn@m...> Date: Mon, 28 Dec 2020 20:26:28 +0900 Subject: [ruby/bigdecimal] Reduce conditional branch count in VpNewVarArg https://github.com/ruby/bigdecimal/commit/741fb3e00f diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 7fdf401..1e6de0e 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -2753,20 +2753,16 @@ VpNewVarArg(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2753 mf = (size_t)n; } - if (SPECIAL_CONST_P(iniValue)) { - switch (iniValue) { - case Qnil: - if (!exc) return NULL; - rb_raise(rb_eTypeError, "can't convert nil into BigDecimal"); - case Qtrue: - if (!exc) return NULL; - rb_raise(rb_eTypeError, "can't convert true into BigDecimal"); - case Qfalse: - if (!exc) return NULL; - rb_raise(rb_eTypeError, "can't convert false into BigDecimal"); - default: - break; - } + switch (iniValue) { + case Qnil: + case Qtrue: + case Qfalse: + if (!exc) return NULL; + rb_raise(rb_eTypeError, + "can't convert %"PRIsVALUE" into BigDecimal", iniValue); + + default: + break; } retry: -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/