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

ruby-changes:49888

From: normal <ko1@a...>
Date: Mon, 22 Jan 2018 12:04:33 +0900 (JST)
Subject: [ruby-changes:49888] normal:r62006 (trunk): time.c (num_exact): use predefined IDs

normal	2018-01-22 12:04:26 +0900 (Mon, 22 Jan 2018)

  New Revision: 62006

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

  Log:
    time.c (num_exact): use predefined IDs
    
    No need to waste space on "to_r" and "to_int" which are
    predefined in defs/id.def

  Modified files:
    trunk/time.c
Index: time.c
===================================================================
--- time.c	(revision 62005)
+++ time.c	(revision 62006)
@@ -501,10 +501,10 @@ num_exact(VALUE v) https://github.com/ruby/ruby/blob/trunk/time.c#L501
         goto typeerror;
     }
     else {
-        if ((tmp = rb_check_funcall(v, rb_intern("to_r"), 0, NULL)) != Qundef) {
+        if ((tmp = rb_check_funcall(v, idTo_r, 0, NULL)) != Qundef) {
             /* test to_int method availability to reject non-Numeric
              * objects such as String, Time, etc which have to_r method. */
-            if (!rb_respond_to(v, rb_intern("to_int"))) goto typeerror;
+            if (!rb_respond_to(v, idTo_int)) goto typeerror;
         }
         else if (!NIL_P(tmp = rb_check_to_int(v))) {
             return tmp;

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

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