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

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

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 Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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