* xmlXPathCacheWrapString: * @pctxt the XPath context * @val: the xmlChar * value * * This is the cached version of xmlXPathWrapString(). * Wraps the @val string into an XPath object. * * Returns the created or reused object. */
| 1700 | * Returns the created or reused object. |
| 1701 | */ |
| 1702 | static xmlXPathObjectPtr |
| 1703 | xmlXPathCacheWrapString(xmlXPathParserContextPtr pctxt, xmlChar *val) |
| 1704 | { |
| 1705 | xmlXPathObjectPtr ret; |
| 1706 | xmlXPathContextPtr ctxt = pctxt->context; |
| 1707 | |
| 1708 | if ((ctxt != NULL) && (ctxt->cache != NULL)) { |
| 1709 | xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; |
| 1710 | |
| 1711 | if (cache->miscObjs != NULL) { |
| 1712 | ret = cache->miscObjs; |
| 1713 | cache->miscObjs = (void *) ret->stringval; |
| 1714 | cache->numMisc -= 1; |
| 1715 | ret->type = XPATH_STRING; |
| 1716 | ret->stringval = val; |
| 1717 | return(ret); |
| 1718 | } |
| 1719 | } |
| 1720 | |
| 1721 | ret = xmlXPathWrapString(val); |
| 1722 | if (ret == NULL) |
| 1723 | xmlXPathPErrMemory(pctxt); |
| 1724 | return(ret); |
| 1725 | } |
| 1726 | |
| 1727 | /** |
| 1728 | * xmlXPathCacheNewNodeSet: |
no test coverage detected