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

Function xmlXPathCacheNewString

ThirdParty/libxml2/vtklibxml2/xpath.c:1807–1840  ·  view source on GitHub ↗

* xmlXPathCacheNewString: * @pctxt the XPath context * @val: the xmlChar * value * * This is the cached version of xmlXPathNewString(). * Acquire an xmlXPathObjectPtr of type string and of value @val * * Returns the created or reused object. */

Source from the content-addressed store, hash-verified

1805 * Returns the created or reused object.
1806 */
1807static xmlXPathObjectPtr
1808xmlXPathCacheNewString(xmlXPathParserContextPtr pctxt, const xmlChar *val)
1809{
1810 xmlXPathObjectPtr ret;
1811 xmlXPathContextPtr ctxt = pctxt->context;
1812
1813 if ((ctxt != NULL) && (ctxt->cache != NULL)) {
1814 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache;
1815
1816 if (cache->miscObjs != NULL) {
1817 xmlChar *copy;
1818
1819 if (val == NULL)
1820 val = BAD_CAST "";
1821 copy = xmlStrdup(val);
1822 if (copy == NULL) {
1823 xmlXPathPErrMemory(pctxt);
1824 return(NULL);
1825 }
1826
1827 ret = cache->miscObjs;
1828 cache->miscObjs = (void *) ret->stringval;
1829 cache->numMisc -= 1;
1830 ret->type = XPATH_STRING;
1831 ret->stringval = copy;
1832 return(ret);
1833 }
1834 }
1835
1836 ret = xmlXPathNewString(val);
1837 if (ret == NULL)
1838 xmlXPathPErrMemory(pctxt);
1839 return(ret);
1840}
1841
1842/**
1843 * xmlXPathCacheNewCString:

Callers 11

xmlXPathCacheNewCStringFunction · 0.85
xmlXPathCacheObjectCopyFunction · 0.85
xmlXPathNameFunctionFunction · 0.85
xmlXPathCompLiteralFunction · 0.85

Calls 3

xmlStrdupFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85
xmlXPathNewStringFunction · 0.85

Tested by

no test coverage detected