diff options
author | Kenta Murata <mrkn@mrkn.jp> | 2020-12-28 20:26:28 +0900 |
---|---|---|
committer | Kenta Murata <mrkn@mrkn.jp> | 2020-12-28 21:16:48 +0900 |
commit | 80d9e457c585038bd4ab2d661b074c7d67955649 (patch) | |
tree | e801562e3c1f81d92c1f41a9568e32fb85e39d18 /ext/bigdecimal | |
parent | 09aca50fc4be0b8bffe89b3583aedfe9c5c3a732 (diff) |
[ruby/bigdecimal] Reduce conditional branch count in VpNewVarArg
https://github.com/ruby/bigdecimal/commit/741fb3e00f
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 7fdf40126e..1e6de0e2db 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -2753,20 +2753,16 @@ VpNewVarArg(int argc, VALUE *argv) 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: |