mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
hlink: Avoid double computation of the string length.
This commit is contained in:
parent
145e06040d
commit
f740a28062
@ -72,24 +72,28 @@ static inline HlinkImpl* HlinkImpl_from_IDataObject( IDataObject* iface)
|
||||
static inline LPWSTR strdupW( LPCWSTR str )
|
||||
{
|
||||
LPWSTR r;
|
||||
UINT len;
|
||||
|
||||
if (!str)
|
||||
return NULL;
|
||||
r = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(str)+1) * sizeof (WCHAR));
|
||||
len = (lstrlenW(str)+1) * sizeof (WCHAR);
|
||||
r = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
if (r)
|
||||
lstrcpyW(r, str);
|
||||
memcpy(r, str, len);
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline LPWSTR co_strdupW( LPCWSTR str )
|
||||
{
|
||||
LPWSTR r;
|
||||
UINT len;
|
||||
|
||||
if (!str)
|
||||
return NULL;
|
||||
r = CoTaskMemAlloc((lstrlenW(str)+1) * sizeof (WCHAR));
|
||||
len = (lstrlenW(str)+1) * sizeof (WCHAR);
|
||||
r = CoTaskMemAlloc(len);
|
||||
if (r)
|
||||
lstrcpyW(r, str);
|
||||
memcpy(r, str, len);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user