Re: [xslt] Bug Fix doubles the XSL preprocessing time



On Tue, Apr 11, 2006 at 09:29:47AM -0700, Jerome Pesenti wrote:
> >    Very simple. If the xmlXPathContext structures
> > changes libxslt
> > would likely *crash* because it relied on the size
> > of the structure
> > it was compiled against, and not the size expected
> > by the used libxml2
> > version
> 
> Ok I get it. 

 :-)

> >    The suggested fix is not acceptable as this
> > create the bug again.
> > You could try to force the reuse of the same
> > xmlXPathContextPtr for
> > all the compilations instead of reallocating a new
> > one each time,
> > that could work, but the current patch is not
> > acceptable.
> 
> I'd like to submit a patch but I want to make sure
> that my solution is acceptable.

  okay,

> 1/ Add a dummy xmlXPathContextPtr to the stylesheet
> structure and initialize it once with
> xmlXPathNewContext when creating the stylsheet
> structure.

  yes something like that except it should go into a compilation
context (which doesn't exist yet so in the style for now, yes).

> 2/ Reuse that structure each time when compiling
> XPaths (is that safe?)

  It's safe because an XPath compilation can't call the XSLT back.
Just make sure you reinitialize the context fields if needed.

> 3/ Free the structure when freeing the stylesheet
> structure.

  yes

> I don't want to create a global to avoid having to
> lock it...

  definitely, that would be plain broken.

  thanks in advance :-)

Daniel

-- 
Daniel Veillard      | Red Hat 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]