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

ruby-changes:38228

From: nobu <ko1@a...>
Date: Tue, 14 Apr 2015 12:36:04 +0900 (JST)
Subject: [ruby-changes:38228] nobu:r50309 (trunk): tkutil.c: use rb_sym2str

nobu	2015-04-14 12:35:54 +0900 (Tue, 14 Apr 2015)

  New Revision: 50309

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

  Log:
    tkutil.c: use rb_sym2str
    
    * ext/tk/tkutil/tkutil.c (rb_sym2str): use rb_sym2str always but
      not rb_sym_to_s, and fallback to rb_id2str and SYM2ID.

  Modified files:
    trunk/ext/tk/tkutil/extconf.rb
    trunk/ext/tk/tkutil/tkutil.c
Index: ext/tk/tkutil/extconf.rb
===================================================================
--- ext/tk/tkutil/extconf.rb	(revision 50308)
+++ ext/tk/tkutil/extconf.rb	(revision 50309)
@@ -4,7 +4,7 @@ begin https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/extconf.rb#L4
   have_func("rb_obj_instance_exec", "ruby.h")
   have_func("rb_obj_untrust", "ruby.h")
   have_func("rb_obj_taint", "ruby.h")
-  have_func("rb_sym_to_s", "ruby.h")
+  have_func("rb_sym2str", "ruby.h")
   have_func("strndup", "string.h")
 
   create_makefile('tkutil')
Index: ext/tk/tkutil/tkutil.c
===================================================================
--- ext/tk/tkutil/tkutil.c	(revision 50308)
+++ ext/tk/tkutil/tkutil.c	(revision 50309)
@@ -42,6 +42,10 @@ static int rb_thread_critical; /* dummy https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L42
 extern char *strndup(const char* _ptr, size_t _len);
 #endif
 
+#ifndef HAVE_RB_SYM2STR
+# define rb_sym2str(obj) rb_id2str(SYM2ID(obj))
+#endif
+
 static VALUE cMethod;
 
 static VALUE cTclTkLib;
@@ -839,11 +843,7 @@ get_eval_string_core(obj, enc_flag, self https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L843
                 return fromDefaultEnc_toUTF8(rb_sym2str(obj), self);
             }
         } else {
-#ifdef HAVE_RB_SYM_TO_S
-            return rb_sym_to_s(obj);
-#else
             return rb_sym2str(obj);
-#endif
         }
 
     case T_HASH:

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

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