Hi,

I learned from the sources that Result Tree Fragments, which
are stored in XPath objects are not freed anymore in the
XPath module itself but freed on Libxslt's side.
There are several comments in the code like:
"Freeing is not handled there anymore"
Therefore the @boolval field of an XPath object is set to 0,
after creation of such an object.

Should we change xmlXPathNewValueTree() in order not to set
the @boolval field to 1? Setting it to 1 indicated that
xmlXPathFreeObject() should free the Result Tree Fragment
via xmlXPathFreeValueTree().

Examples:

In exsltStrSplitFunction():
  ret = xmlXPathNewNodeSet(NULL);
  ret->boolval = 0; /* Freeing is not handled there anymore */

Here the setting of the @boolval to 0 is actually not needed,
since a node set is created (xmlXPathNewNodeSet()). This
unnecessary setting of @boolval might indicate that the current
state confuses extension authors; they might be unsure of
what will be freed when, how and why.

In xsltEvalGlobalVariable():
result = xmlXPathNewValueTree((xmlNodePtr) container);
result->boolval = 0; /* Freeing is not handled there anymore */

Here the @boolval is set to indicate that the XPath module
should not free the Result Tree Fragment.

Would such a change (setting @boolval to 0 by default) break user
code or rather avoid confusion and errors, since RTF must be
handled only by Libxslt?

Regards,

Kasimier
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt

Reply via email to