#20 Proposal for XML_ParserReset function

Feature Request
closed-accepted
None
5
2002-04-24
2001-08-13
David Crowley
No

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);

Discussion

  • David Crowley
    David Crowley
    2001-08-13

    Patch to add XML_ParserReset() to xmlparse.c

     
    Attachments
    • milestone: --> Feature Request
    • assigned_to: nobody --> fdrake
     
  • 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!

     
    • status: open --> closed-accepted
     
  • 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.