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

ruby-changes:30581

From: nobu <ko1@a...>
Date: Fri, 23 Aug 2013 17:17:54 +0900 (JST)
Subject: [ruby-changes:30581] nobu:r42660 (trunk): win32ole.c: no copy string

nobu	2013-08-23 17:17:47 +0900 (Fri, 23 Aug 2013)

  New Revision: 42660

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

  Log:
    win32ole.c: no copy string
    
    * ext/win32ole/win32ole.c (foletypelib_name, foletypelib_path):
      WC2VSTR() returns a string in cWIN32OLE_enc, no need to copy another
      string.

  Modified files:
    trunk/ext/win32ole/win32ole.c
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 42659)
+++ ext/win32ole/win32ole.c	(revision 42660)
@@ -5281,7 +5281,7 @@ foletypelib_name(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L5281
         ole_raise(hr, eWIN32OLERuntimeError, "failed to get name from ITypeLib");
     }
     name = WC2VSTR(bstr);
-    return rb_enc_str_new(StringValuePtr(name), strlen(StringValuePtr(name)), cWIN32OLE_enc);
+    return name;
 }
 
 /*
@@ -5436,7 +5436,7 @@ foletypelib_path(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L5436
 
     pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
     path = WC2VSTR(bstr);
-    return rb_enc_str_new(StringValuePtr(path), strlen(StringValuePtr(path)), cWIN32OLE_enc);
+    return path;
 }
 
 /*

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

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