summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-12-28 20:26:28 +0900
committerKenta Murata <mrkn@mrkn.jp>2020-12-28 21:16:48 +0900
commit80d9e457c585038bd4ab2d661b074c7d67955649 (patch)
treee801562e3c1f81d92c1f41a9568e32fb85e39d18 /ext
parent09aca50fc4be0b8bffe89b3583aedfe9c5c3a732 (diff)
[ruby/bigdecimal] Reduce conditional branch count in VpNewVarArg
https://github.com/ruby/bigdecimal/commit/741fb3e00f
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c24
1 files changed, 10 insertions, 14 deletions
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)
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: