[#3006] CVS repository — "Eugene Scripnik" <hoaz@...>

Hello.

21 messages 2004/06/16
[#3008] Re: CVS repository — ts <decoux@...> 2004/06/16

>>>>> "E" == Eugene Scripnik <hoaz@gala.net> writes:

[#3009] Re: CVS repository — Michal Rokos <michal@...> 2004/06/16

Hi!

[#3057] Ruby 1.8.2 to be released. — matz@... (Yukihiro Matsumoto)

Hi,

20 messages 2004/06/23

[Patch] Small compar.c cleanup

From: Michal Rokos <michal@...>
Date: 2004-06-21 20:57:52 UTC
List: ruby-core #3040
Hi,

I think that explicit checks for NIL_P() are not necessary since
rb_cmpint() handles them in the exactly same manner.

Any opinion?

	Michal

Index: compar.c
===================================================================
RCS file: /var/cvs/src/ruby/compar.c,v
retrieving revision 1.23
diff -u -p -r1.23 compar.c
--- compar.c    19 Dec 2003 00:01:18 -0000      1.23
+++ compar.c    21 Jun 2004 20:54:45 -0000
@@ -50,8 +50,6 @@ rb_cmperr(x, y)
             rb_obj_classname(x), classname);
 }

-#define cmperr() (rb_cmperr(x, y), Qnil)
-
 static VALUE
 cmp_eq(a)
     VALUE *a;
@@ -104,7 +102,6 @@ cmp_gt(x, y)
 {
     VALUE c = rb_funcall(x, cmp, 1, y);

-    if (NIL_P(c)) return cmperr();
     if (rb_cmpint(c, x, y) > 0) return Qtrue;
     return Qfalse;
 }
@@ -123,7 +120,6 @@ cmp_ge(x, y)
 {
     VALUE c = rb_funcall(x, cmp, 1, y);

-    if (NIL_P(c)) return cmperr();
     if (rb_cmpint(c, x, y) >= 0) return Qtrue;
     return Qfalse;
 }
@@ -142,7 +138,6 @@ cmp_lt(x, y)
 {
     VALUE c = rb_funcall(x, cmp, 1, y);

-    if (NIL_P(c)) return cmperr();
     if (rb_cmpint(c, x, y) < 0) return Qtrue;
     return Qfalse;
 }
@@ -162,7 +157,6 @@ cmp_le(x, y)
 {
     VALUE c = rb_funcall(x, cmp, 1, y);

-    if (NIL_P(c)) return cmperr();
     if (rb_cmpint(c, x, y) <= 0) return Qtrue;
     return Qfalse;
 }

In This Thread

Prev Next