| 148 | static xmlXPathContextPtr ctxtXPath; |
| 149 | |
| 150 | static void |
| 151 | initializeLibxml2(void) { |
| 152 | xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); |
| 153 | xmlInitParser(); |
| 154 | xmlSetExternalEntityLoader(testExternalEntityLoader); |
| 155 | ctxtXPath = xmlXPathNewContext(NULL); |
| 156 | /* |
| 157 | * Deactivate the cache if created; otherwise we have to create/free it |
| 158 | * for every test, since it will confuse the memory leak detection. |
| 159 | * Note that normally this need not be done, since the cache is not |
| 160 | * created until set explicitly with xmlXPathContextSetCache(); |
| 161 | * but for test purposes it is sometimes useful to activate the |
| 162 | * cache by default for the whole library. |
| 163 | */ |
| 164 | if (ctxtXPath->cache != NULL) |
| 165 | xmlXPathContextSetCache(ctxtXPath, 0, -1, 0); |
| 166 | } |
| 167 | |
| 168 | /************************************************************************ |
| 169 | * * |
no test coverage detected