Skip to content

Commit

Permalink
Reduce conditional branch count in VpNewVarArg
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkn committed Dec 28, 2020
1 parent f24116f commit 741fb3e
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions ext/bigdecimal/bigdecimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 741fb3e

Please sign in to comment.