[前][次][番号順一覧][スレッド一覧]

ruby-changes:44691

From: nobu <ko1@a...>
Date: Sun, 13 Nov 2016 11:04:56 +0900 (JST)
Subject: [ruby-changes:44691] nobu:r56764 (trunk): numeric.c: limit return value

nobu	2016-11-13 11:04:51 +0900 (Sun, 13 Nov 2016)

  New Revision: 56764

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56764

  Log:
    numeric.c: limit return value
    
    * numeric.c (num_equal): limit return value to true or false,
      instead of the result of the other as-is.

  Modified files:
    trunk/numeric.c
Index: numeric.c
===================================================================
--- numeric.c	(revision 56763)
+++ numeric.c	(revision 56764)
@@ -1356,8 +1356,11 @@ num_cmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1356
 static VALUE
 num_equal(VALUE x, VALUE y)
 {
+    VALUE result;
     if (x == y) return Qtrue;
-    return num_funcall1(y, id_eq, x);
+    result = num_funcall1(y, id_eq, x);
+    if (RTEST(result)) return Qtrue;
+    return Qfalse;
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]