[Expat-discuss] Using XML_GetBuffer/XML_ParseBuffer

James Whetstone jameswhetstone at comcast.net
Sat Sep 23 23:58:23 CEST 2006


So I stepped through the code to see what happens to unused fragments, and 
it leaves the fragments in the buffer.  From what I can tell, instead of 
moving the offset of the input buffer, XML_GetBuffer is intended to be 
called each time new input is to be accepted.  It then allocates a new 
(larger) buffer, memcpys the fragment from the old buffer to the new buffer 
and then frees the old buffer.  I'd like to avoid this by simple moving the 
input buffer's offset to the a end of the fragment and NOT calling 
XML_GetBuffer to avoid the extran memory allocation.  Any suggestions?

---James

----- Original Message ----- 
From: "Karl Waclawek" <karl at waclawek.net>
To: "James Whetstone" <jameswhetstone at comcast.net>
Cc: <expat-discuss at libexpat.org>
Sent: Saturday, September 23, 2006 1:29 PM
Subject: Re: [Expat-discuss] Using XML_GetBuffer/XML_ParseBuffer


> James Whetstone wrote:
>> Another question along the same lines is whether or not I even need to 
>> worry about overwriting left over data in the XML Buffer.  I assumed 
>> there would sometimes be some left over data of a XML fragment in the 
>> buffer, but maybe that isn't the case.
>>
>>
> If I remember correctly, Expat buffers any unused fragments. So you should 
> not have to worry.
>
> Karl 



More information about the Expat-discuss mailing list