* xmlXPathContextSetCache: * * @ctxt: the XPath context * @active: enables/disables (creates/frees) the cache * @value: a value with semantics dependent on @options * @options: options (currently only the value 0 is used) * * Creates/frees an object cache on the XPath context. * If activates XPath objects (xmlXPathObject) will be cached internally * to be reused. * @options: * 0: Thi
| 1619 | * Returns 0 if the setting succeeded, and -1 on API or internal errors. |
| 1620 | */ |
| 1621 | int |
| 1622 | xmlXPathContextSetCache(xmlXPathContextPtr ctxt, |
| 1623 | int active, |
| 1624 | int value, |
| 1625 | int options) |
| 1626 | { |
| 1627 | if (ctxt == NULL) |
| 1628 | return(-1); |
| 1629 | if (active) { |
| 1630 | xmlXPathContextCachePtr cache; |
| 1631 | |
| 1632 | if (ctxt->cache == NULL) { |
| 1633 | ctxt->cache = xmlXPathNewCache(); |
| 1634 | if (ctxt->cache == NULL) { |
| 1635 | xmlXPathErrMemory(ctxt); |
| 1636 | return(-1); |
| 1637 | } |
| 1638 | } |
| 1639 | cache = (xmlXPathContextCachePtr) ctxt->cache; |
| 1640 | if (options == 0) { |
| 1641 | if (value < 0) |
| 1642 | value = 100; |
| 1643 | cache->maxNodeset = value; |
| 1644 | cache->maxMisc = value; |
| 1645 | } |
| 1646 | } else if (ctxt->cache != NULL) { |
| 1647 | xmlXPathFreeCache((xmlXPathContextCachePtr) ctxt->cache); |
| 1648 | ctxt->cache = NULL; |
| 1649 | } |
| 1650 | return(0); |
| 1651 | } |
| 1652 | |
| 1653 | /** |
| 1654 | * xmlXPathCacheWrapNodeSet: |
no test coverage detected