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.