Skip to content

Commit

Permalink
win32ole.c: no copy string
Browse files Browse the repository at this point in the history
* ext/win32ole/win32ole.c (foletypelib_name, foletypelib_path):
  WC2VSTR() returns a string in cWIN32OLE_enc, no need to copy another
  string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Aug 23, 2013
1 parent e2b08f4 commit 3134c5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/win32ole/win32ole.c
Original file line number Diff line number Diff line change
Expand Up @@ -5281,7 +5281,7 @@ foletypelib_name(VALUE self)
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;
}

/*
Expand Down Expand Up @@ -5436,7 +5436,7 @@ foletypelib_path(VALUE self)

pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
path = WC2VSTR(bstr);
return rb_enc_str_new(StringValuePtr(path), strlen(StringValuePtr(path)), cWIN32OLE_enc);
return path;
}

/*
Expand Down

0 comments on commit 3134c5e

Please sign in to comment.