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

Alexandre Julliard julliard at winehq.org
Mon Aug 19 07:01:58 CDT 2013


John Chadwick <johnwchadwick at gmail.com> writes:

> This patch was posted a bit ago without any objections, but seemingly
> slipped through the cracks. Very slight revisions were made since try
> 3 to improve the conciseness of code.
>
> From 8157b8a3d347c47f7f21e74d621632b4a9f50fd6 Mon Sep 17 00:00:00 2001
> From: John Chadwick <johnwchadwick at gmail.com>
> Date: Sun, 21 Jul 2013 14:41:37 -0400
> Subject: msxml3: Defer the conversion of XPath expressions to UTF-8.
>
> 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 implementation of tagName_to_XPath also had to be changed as it was using
> libxml2's UTF-8 string API. libxml2 contained a strcat that performed
> reallocation, so it was replaced with a new function that does the same with
> heap_realloc and wide strings (heap_strcatW in msxml_private.h.)

That's a very inefficient way to build a string. Adding this as a helper
is even worse since it will encourage other places to use it too. Please
try to allocate a large enough buffer from the start, or if not possible
grow it quadratically.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list