MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathNewContext

Function xmlXPathNewContext

ThirdParty/libxml2/vtklibxml2/xpath.c:5096–5138  ·  view source on GitHub ↗

* xmlXPathNewContext: * @doc: the XML document * * Create a new xmlXPathContext * * Returns the xmlXPathContext just allocated. The caller will need to free it. */

Source from the content-addressed store, hash-verified

5094 * Returns the xmlXPathContext just allocated. The caller will need to free it.
5095 */
5096xmlXPathContextPtr
5097xmlXPathNewContext(xmlDocPtr doc) {
5098 xmlXPathContextPtr ret;
5099
5100 ret = (xmlXPathContextPtr) xmlMalloc(sizeof(xmlXPathContext));
5101 if (ret == NULL)
5102 return(NULL);
5103 memset(ret, 0 , sizeof(xmlXPathContext));
5104 ret->doc = doc;
5105 ret->node = NULL;
5106
5107 ret->varHash = NULL;
5108
5109 ret->nb_types = 0;
5110 ret->max_types = 0;
5111 ret->types = NULL;
5112
5113 ret->nb_axis = 0;
5114 ret->max_axis = 0;
5115 ret->axis = NULL;
5116
5117 ret->nsHash = NULL;
5118 ret->user = NULL;
5119
5120 ret->contextSize = -1;
5121 ret->proximityPosition = -1;
5122
5123#ifdef XP_DEFAULT_CACHE_ON
5124 if (xmlXPathContextSetCache(ret, 1, -1, 0) == -1) {
5125 xmlXPathFreeContext(ret);
5126 return(NULL);
5127 }
5128#endif
5129
5130 xmlXPathRegisterAllFunctions(ret);
5131
5132 if (ret->lastError.code != XML_ERR_OK) {
5133 xmlXPathFreeContext(ret);
5134 return(NULL);
5135 }
5136
5137 return(ret);
5138}
5139
5140/**
5141 * xmlXPathFreeContext:

Callers 14

doXPathQueryFunction · 0.85
initializeLibxml2Function · 0.85
xmlXPathCtxtCompileFunction · 0.85
xmlXPtrNewContextFunction · 0.85
runtest.cFile · 0.85
load_xpath_exprFunction · 0.85
xmlShellLoadFunction · 0.85
xmlShellFunction · 0.85

Calls 3

xmlXPathContextSetCacheFunction · 0.85
xmlXPathFreeContextFunction · 0.85

Tested by 1

load_xpath_exprFunction · 0.68