Re: Using XML_GetBuffer/XML_ParseBuffer
"James Whetstone" <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <001901c6df5b$641edcc0$6401a8c0@crankshaft> |
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" <[email protected]> To: "James Whetstone" <[email protected]> Cc: <[email protected]> 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