[ expat-Patches-450608 ] Proposal for XML_ParserReset function

noreply@sourceforge.net noreply@sourceforge.net
Tue Apr 23 20:39:04 2002


Patches item #450608, was opened at 2001-08-13 17: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: Closed
>Resolution: Accepted
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: 2002-04-23 23:38

Message:
Logged In: YES 
user_id=3066

Checked in updated version of patch received by email as
lib/xmlparse.c revision 1.30, with a prototype added to
lib/expat.h revision 1.17.

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

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-08-16 00: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