Re: [xml] [htmlParser] The right way to free a htmlParserCtxtPtr



On Tue, Nov 02, 2004 at 06:46:16AM +0100, Emmanuel Saracco wrote:
Hi,

I am wondering what is the most effective to free a htmlParserCtxtPtr.
For the moment I do the following:

-----
htmlParserCtxtPtr ctxt = NULL;

ctxt = htmlCreateMemoryParserCtxt (buffer, strlen (buffer));
htmlParseDocument (ctxt);

htmlFreeParserCtxt (ctxt);
-----

  that's fine.

But browing the libxml2 source code I saw that there is a "htmlCtxtReset
()" that seems to really freeing all stuff (including "ctxt->myDoc").
Should I call this function just before calling "htmlFreeParserCtxt ()"?

  This should be used only if you want to parse a collection of html
document with the same context, then the reset call should be used between
2 parses.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]