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

ruby-changes:38230

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

nobu	2015-04-14 12:36:40 +0900 (Tue, 14 Apr 2015)

  New Revision: 50311

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

  Log:
    win32ole.c: use rb_sym2str
    
    * ext/win32ole/win32ole.c: use rb_sym2str when the result strings
      will not be modified.
    
    * ext/win32ole/win32ole_event.c: ditto.
    
    * ext/win32ole/win32ole_record.c: ditto.

  Modified files:
    trunk/ext/win32ole/win32ole.c
    trunk/ext/win32ole/win32ole_event.c
    trunk/ext/win32ole/win32ole_record.c
Index: ext/win32ole/win32ole_record.c
===================================================================
--- ext/win32ole/win32ole_record.c	(revision 50310)
+++ ext/win32ole/win32ole_record.c	(revision 50311)
@@ -288,7 +288,7 @@ folerecord_initialize(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_record.c#L288
         rb_raise(rb_eArgError, "1st argument should be String or Symbol");
     }
     if (RB_TYPE_P(typename, T_SYMBOL)) {
-        typename = rb_sym_to_s(typename);
+        typename = rb_sym2str(typename);
     }
 
     hr = S_OK;
@@ -452,7 +452,7 @@ folerecord_method_missing(int argc, VALU https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_record.c#L452
 {
     VALUE name;
     rb_check_arity(argc, 1, 2);
-    name = rb_sym_to_s(argv[0]);
+    name = rb_sym2str(argv[0]);
 
 #if SIZEOF_SIZE_T > SIZEOF_LONG
     {
@@ -508,7 +508,7 @@ folerecord_ole_instance_variable_get(VAL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_record.c#L508
     }
     sname = name;
     if (RB_TYPE_P(name, T_SYMBOL)) {
-        sname = rb_sym_to_s(name);
+        sname = rb_sym2str(name);
     }
     return olerecord_ivar_get(self, sname);
 }
@@ -547,7 +547,7 @@ folerecord_ole_instance_variable_set(VAL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_record.c#L547
     }
     sname = name;
     if (RB_TYPE_P(name, T_SYMBOL)) {
-        sname = rb_sym_to_s(name);
+        sname = rb_sym2str(name);
     }
     return olerecord_ivar_set(self, sname, val);
 }
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 50310)
+++ ext/win32ole/win32ole.c	(revision 50311)
@@ -2513,7 +2513,7 @@ hash2named_arg(VALUE key, VALUE val, VAL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2513
         rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
     }
     if (RB_TYPE_P(key, T_SYMBOL)) {
-	key = rb_sym_to_s(key);
+	key = rb_sym2str(key);
     }
 
     /* pNamedArgs[0] is <method name>, so "index + 1" */
@@ -2580,7 +2580,7 @@ ole_invoke(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2580
 	rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)");
     }
     if (RB_TYPE_P(cmd, T_SYMBOL)) {
-	cmd = rb_sym_to_s(cmd);
+	cmd = rb_sym2str(cmd);
     }
     pole = oledata_get_struct(self);
     if(!pole->pDispatch) {
@@ -3577,7 +3577,7 @@ fole_respond_to(VALUE self, VALUE method https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3577
         rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
     }
     if (RB_TYPE_P(method, T_SYMBOL)) {
-        method = rb_sym_to_s(method);
+        method = rb_sym2str(method);
     }
     pole = oledata_get_struct(self);
     wcmdname = ole_vstr2wc(method);
Index: ext/win32ole/win32ole_event.c
===================================================================
--- ext/win32ole/win32ole_event.c	(revision 50310)
+++ ext/win32ole/win32ole_event.c	(revision 50311)
@@ -1041,7 +1041,7 @@ ev_on_event(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L1041
             rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
         }
         if (RB_TYPE_P(event, T_SYMBOL)) {
-            event = rb_sym_to_s(event);
+            event = rb_sym2str(event);
         }
     }
     data = rb_ary_new3(4, rb_block_proc(), event, args, is_ary_arg);
@@ -1131,7 +1131,7 @@ fev_off_event(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L1131
             rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
         }
         if (RB_TYPE_P(event, T_SYMBOL)) {
-            event = rb_sym_to_s(event);
+            event = rb_sym2str(event);
         }
     }
     events = rb_ivar_get(self, id_events);

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

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