summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/range.c b/range.c
index a0ae98cba4..3f575de91b 100644
--- a/range.c
+++ b/range.c
@@ -29,11 +29,7 @@ static VALUE
range_check(args)
VALUE *args;
{
- VALUE v;
-
- v = rb_funcall(args[0], id_cmp, 1, args[1]);
- if (NIL_P(v)) range_failed();
- return Qnil;
+ return rb_funcall(args[0], id_cmp, 1, args[1]);
}
static void
@@ -47,7 +43,10 @@ range_init(range, beg, end, exclude_end)
args[1] = end;
if (!FIXNUM_P(beg) || !FIXNUM_P(end)) {
- rb_rescue(range_check, (VALUE)args, range_failed, 0);
+ VALUE v;
+
+ v = rb_rescue(range_check, (VALUE)args, range_failed, 0);
+ if (NIL_P(v)) range_failed();
}
SET_EXCL(range, exclude_end);