summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-18 18:05:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-18 18:05:11 +0000
commit6987b0806e970c7e4b19800c2a2effc290947b78 (patch)
tree79823d81475a9659b3c0e21988721c7d6b200d04 /range.c
parent18cdaa6828045306da4aa95f3828f634a8c9d0ee (diff)
* struct.c (rb_struct_eql): should compare values with "eql?".
* range.c (range_check): <=> returns nil for invalid values; should check. * regex.c (re_compile_pattern): should not set RE_OPTIMIZE_ANCHOR, if anychar_repeat is enclosed by parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/range.c b/range.c
index 830228e..e0d17f4 100644
--- a/range.c
+++ b/range.c
@@ -19,19 +19,21 @@ static ID id_cmp, id_succ, id_beg, id_end, id_excl;
#define SET_EXCL(r,v) rb_ivar_set((r), id_excl, (v) ? Qtrue : Qfalse)
static VALUE
-range_check(args)
- VALUE *args;
+range_failed()
{
- rb_funcall(args[0], id_cmp, 1, args[1]);
- /* rb_funcall(args[0], id_succ, 0, 0); */
- return Qnil;
+ rb_raise(rb_eArgError, "bad value for range");
+ return Qnil; /* dummy */
}
static VALUE
-range_failed()
+range_check(args)
+ VALUE *args;
{
- rb_raise(rb_eArgError, "bad value for range");
- return Qnil; /* dummy */
+ VALUE v;
+
+ v = rb_funcall(args[0], id_cmp, 1, args[1]);
+ if (NIL_P(v)) range_failed();
+ return Qnil;
}
static void