Commit f740a280 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

hlink: Avoid double computation of the string length.

parent 145e0604
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment