msxml3: Defer the conversion of XPath expressions to UTF-8. (try 2)

Nikolay Sivov bunglehead at gmail.com
Sun Jul 21 12:10:17 CDT 2013


On 7/20/2013 23:37, John Chadwick wrote:
> This patch changes the create_selection interface to accept a wide string
> instead of an xmlChar string. This is a transitional change, which will be
> needed as libxml2's XPath parser is phased out.
>
> The last submission had a memory leak (sorry, I isolated this change
> from some other changes and accidentally axed a heap_free in the
> process.)
Looks ok, I didn't try tests, but I hope you did..

One thing though:

> +static inline WCHAR *heap_strcatW(WCHAR *a, const WCHAR *b)
> +{
> +    int len = strlenW(a) + strlenW(b);
> +    WCHAR *c = heap_realloc(a, (len + 1) * sizeof(WCHAR));
> +    WCHAR *ptr = c;
> +
> +    while(*ptr)
> +        ptr++;
> +    while(*b)
> +        *(ptr++) = *(b++);
> +    c[len] = 0;
> +
> +    return c;
> +}
> +

I'm assuming you didn't use strcatW() to avoid one more strlenW()? Even 
if you don't want to use
it for some reason, you don't need first loop cause you already know 'a' 
length, and second loop
is just strcpyW(). Also I suggest to use 'dst', 'src' names for parameters.



More information about the wine-devel mailing list