mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
Added an XPath object cache. It sits on an xmlXPathContext and need to be
* xpath.c include/libxml/xpath.h: Added an XPath object cache. It sits on an xmlXPathContext and need to be explicitely activated (or deactivated again) with xmlXPathContextSetObjectCache(). The cache consists of 5 lists for node-set, string, number, boolean and misc XPath objects. Internally the xpath.c module will use object- deposition and -acquisition functions which will try to reuse as many XPath objects as possible, and fallback to normal free/create behaviour if no cache is available or if the cache is full. * runsuite.c: Adjusted to deactivate the cache for XML Schema tests if a cache-creation is turned on by default for the whole library, e.g. for testing purposes of the cache. It is deactivated here in order to avoid confusion of the memory leak detection in runsuite.c.
This commit is contained in:
@@ -35,6 +35,7 @@ extern "C" {
|
||||
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
||||
typedef struct _xmlXPathContext xmlXPathContext;
|
||||
typedef xmlXPathContext *xmlXPathContextPtr;
|
||||
typedef struct _xmlXPathParserContext xmlXPathParserContext;
|
||||
@@ -343,6 +344,7 @@ struct _xmlXPathContext {
|
||||
xmlDictPtr dict; /* dictionnary if any */
|
||||
|
||||
int flags; /* flags to control compilation */
|
||||
void *objCache; /* Cache for reusal of XPath objects. */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -485,9 +487,13 @@ XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
||||
*/
|
||||
XMLPUBFUN xmlXPathContextPtr XMLCALL
|
||||
xmlXPathNewContext (xmlDocPtr doc);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlXPathContextSetObjectCache(xmlXPathContextPtr ctxt,
|
||||
int active,
|
||||
int maxNumberPerSlot,
|
||||
int options);
|
||||
/**
|
||||
* Evaluation functions.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user