From 6987b0806e970c7e4b19800c2a2effc290947b78 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 18 Apr 2003 18:05:11 +0000 Subject: * 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 --- range.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'range.c') diff --git a/range.c b/range.c index 830228eed6..e0d17f46c2 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 -- cgit v1.2.3