From 760ae4a8b9fe6844c95cd90254fd6d0f03cf2be7 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 14 Apr 2015 03:36:40 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/win32ole/win32ole.c | 6 +++--- ext/win32ole/win32ole_event.c | 4 ++-- ext/win32ole/win32ole_record.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'ext/win32ole') diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 025a828ec5..2ce8b5a226 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -2513,7 +2513,7 @@ hash2named_arg(VALUE key, VALUE val, VALUE pop) 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 , so "index + 1" */ @@ -2580,7 +2580,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) 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) 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); diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c index 105308a348..c918a2b341 100644 --- a/ext/win32ole/win32ole_event.c +++ b/ext/win32ole/win32ole_event.c @@ -1041,7 +1041,7 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg) 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, VALUE self) 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); diff --git a/ext/win32ole/win32ole_record.c b/ext/win32ole/win32ole_record.c index 28d6238492..e8838832a7 100644 --- a/ext/win32ole/win32ole_record.c +++ b/ext/win32ole/win32ole_record.c @@ -288,7 +288,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) { 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, VALUE *argv, VALUE self) { 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(VALUE self, VALUE name) } 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(VALUE self, VALUE name, VALUE val) } 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); } -- cgit v1.2.3