* xmlXPathCacheNewBoolean: * @pctxt the XPath context * @val: the boolean value * * This is the cached version of xmlXPathNewBoolean(). * Acquires an xmlXPathObjectPtr of type boolean and of value @val * * Returns the created or reused object. */
| 1866 | * Returns the created or reused object. |
| 1867 | */ |
| 1868 | static xmlXPathObjectPtr |
| 1869 | xmlXPathCacheNewBoolean(xmlXPathParserContextPtr pctxt, int val) |
| 1870 | { |
| 1871 | xmlXPathObjectPtr ret; |
| 1872 | xmlXPathContextPtr ctxt = pctxt->context; |
| 1873 | |
| 1874 | if ((ctxt != NULL) && (ctxt->cache != NULL)) { |
| 1875 | xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; |
| 1876 | |
| 1877 | if (cache->miscObjs != NULL) { |
| 1878 | ret = cache->miscObjs; |
| 1879 | cache->miscObjs = (void *) ret->stringval; |
| 1880 | cache->numMisc -= 1; |
| 1881 | ret->stringval = NULL; |
| 1882 | ret->type = XPATH_BOOLEAN; |
| 1883 | ret->boolval = (val != 0); |
| 1884 | return(ret); |
| 1885 | } |
| 1886 | } |
| 1887 | |
| 1888 | ret = xmlXPathNewBoolean(val); |
| 1889 | if (ret == NULL) |
| 1890 | xmlXPathPErrMemory(pctxt); |
| 1891 | return(ret); |
| 1892 | } |
| 1893 | |
| 1894 | /** |
| 1895 | * xmlXPathCacheNewFloat: |
no test coverage detected