[ expat-Patches-450608 ] Proposal for XML_ParserReset function

noreply@sourceforge.net noreply@sourceforge.net
Wed, 15 Aug 2001 21:20:39 -0700


Patches item #450608, was opened at 2001-08-13 14:01
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=450608&group_id=10127

Category: None
>Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: David Crowley (dcrowley)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Proposal for XML_ParserReset function

Initial Comment:

This is my first cut at adding a XML_ParserReset 
function.  My idea was to reset the parser to a state 
that was almost identical to what it is after 
XML_ParserCreate() except that any allocated memory is 
preserved.  As this patch is currently, I think it 
misght still has some potential problems with dtdInit
() and possibly internalEncoding and setContext().  
But for my documents/application it seems to work 
great.  It passes Purify without any memory leaks and 
when parsing 5000 documents, I only get ~40 memory 
allocations instead of ~200,000 :)

The function declartion needed for expat.h:

/* Resets an existing parser to a state comparable to 
that after
   XML_ParserCreate but preserves any allocated 
memory. */

XMLPARSEAPI(void)
XML_ParserReset(XML_Parser parser, const XML_Char 
*encoding);



----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-08-15 21:20

Message:
Logged In: YES 
user_id=3066

Well, the number of allocations being so substantially reduced is nice to know.  I don't know just when I'll get a chance to look at this, but I promise I will get to it!

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=450608&group_id=10127