msxml3: IXMLDOMText_get_text return trimmed text when XML_TEXT_NODE
octavian.voicu at gmail.com
Thu Sep 2 17:23:07 CDT 2010
On Thu, Sep 2, 2010 at 1:52 PM, GOUJON Alexandre <ale.goujon at gmail.com>wrote:
> On 09/02/2010 12:10 PM, Alexandre Julliard wrote:
>> That's ugly and inefficient, especially since the common case is to not
>> modify it.
> Well, in fact I don't modify the content.
> I just trim the output of bstr_from_xmlChar( xmlNodeGetContent(
> (xmlNodePtr)This->node ) )
> And I made a separate function to not overload xml_get_text.
I think what Alexandre J means is that you are reallocating the buffer every
time (even if there is no whitespace to trim), which is inefficient for the
average case (in which there will be no whitespace to trim). You only have
to reallocate the string if (j - i < len - 1).
You could also try this hack: you don't have to reallocate the string even
if it has whitespace, use memmove to get rid of the leading whitespace, then
just set the string's length to j - i + 1.
Not sure if it makes sense to reallocate the string if it's empty.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the wine-devel