On Sun, 2004-02-29 at 19:42, Michael Kröll wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Matt Sergeant wrote: > | All working now, and checked into CVS. > :-) > > | I guess it's probably time for a new release. > There are calls to xmlCleanupParser() now in LibXSLT.xs - Christian > removed these calls around parser calls from LibXML.xs. Should they be > removed from LibXSLT.xs as well and replaced by the same logic as found > in LibXML_cleanup_callbacks() in LibXML.xs?
This is correct. xmlCleanupParser() as well as xmlInitParser(), must get used only once. While xmlInitParser() may not cause too much harm (?), xmlCleanupParser() frees all global/static memory for the parser as documented in the libxml2 docs. Michael and me discussed this issue a few days ago. The attached patch corrects the existing cvs code. Christian
--- LibXSLT.xs.orig 2004-03-01 17:31:26.000000000 +0100 +++ LibXSLT.xs 2004-03-01 17:41:13.000000000 +0100 @@ -702,7 +702,6 @@ XSRETURN_UNDEF; } - xmlInitParser(); xmlRegisterInputCallbacks((xmlInputMatchCallback) LibXSLT_input_match, (xmlInputOpenCallback) LibXSLT_input_open, (xmlInputReadCallback) LibXSLT_input_read, @@ -720,7 +719,8 @@ } RETVAL = xsltParseStylesheetDoc(doc_copy); - xmlCleanupParser(); + xmlCleanupInputCallbacks(); + xmlRegisterDefaultInputCallbacks(); if (RETVAL == NULL) { XSRETURN_UNDEF; @@ -735,7 +735,6 @@ PREINIT: char * CLASS = "XML::LibXSLT::Stylesheet"; CODE: - xmlInitParser(); xmlRegisterInputCallbacks((xmlInputMatchCallback) LibXSLT_input_match, (xmlInputOpenCallback) LibXSLT_input_open, (xmlInputReadCallback) LibXSLT_input_read, @@ -749,7 +748,8 @@ } RETVAL = xsltParseStylesheetFile(filename); - xmlCleanupParser(); + xmlCleanupInputCallbacks(); + xmlRegisterDefaultInputCallbacks(); if (RETVAL == NULL) { XSRETURN_UNDEF; @@ -802,13 +802,15 @@ else { xsltSetGenericDebugFunc(NULL, NULL); } - xmlInitParser(); xmlRegisterInputCallbacks((xmlInputMatchCallback) LibXSLT_input_match, (xmlInputOpenCallback) LibXSLT_input_open, (xmlInputReadCallback) LibXSLT_input_read, (xmlInputCloseCallback) LibXSLT_input_close); real_dom = xsltApplyStylesheet(self, doc, xslt_params); - xmlCleanupParser(); + + xmlCleanupInputCallbacks(); + xmlRegisterDefaultInputCallbacks(); + if (real_dom == NULL) { if (SvTRUE(ERRSV)) { croak("Exception occurred while applying stylesheet: %s", SvPV(ERRSV, len));
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]