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

ruby-changes:44702

From: nobu <ko1@a...>
Date: Mon, 14 Nov 2016 13:02:49 +0900 (JST)
Subject: [ruby-changes:44702] nobu:r56775 (trunk): rational.c: cast to int

nobu	2016-11-14 13:02:45 +0900 (Mon, 14 Nov 2016)

  New Revision: 56775

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

  Log:
    rational.c: cast to int
    
    * rational.c (f_kind_of_p): rb_obj_is_kind_of returns Qtrue or
      Qfalse always, and is safe to cast down to int.

  Modified files:
    trunk/rational.c
Index: rational.c
===================================================================
--- rational.c	(revision 56774)
+++ rational.c	(revision 56775)
@@ -212,8 +212,7 @@ f_minus_one_p(VALUE x) https://github.com/ruby/ruby/blob/trunk/rational.c#L212
 inline static int
 f_kind_of_p(VALUE x, VALUE c)
 {
-    VALUE ret = rb_obj_is_kind_of(x, c);
-    return RTEST(ret);
+    return (int)rb_obj_is_kind_of(x, c);
 }
 
 inline static int

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

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