[PATCH] include: Add and use a global heap_strdupW() helper

Alexandre Julliard julliard at winehq.org
Mon Feb 12 04:23:39 CST 2018


Michael Stefaniuc <mstefani at winehq.org> writes:

> +static inline WCHAR *heap_strdupW(const WCHAR *str)
> +{
> +    WCHAR *dst;
> +    SIZE_T len;
> +
> +    if(!str)
> +        return NULL;
> +
> +    len = (lstrlenW(str) + 1) * sizeof(*str);
> +    dst = heap_alloc(len);
> +    if (dst)
> +        memcpy(dst, str, len);
> +
> +    return dst;
> +}

I'm not sure the NULL check is a good idea.

(just when you thought this one would not be controversial ;-)

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list