| 200 | static xmlXPathContextPtr ctxtXPath; |
| 201 | |
| 202 | static void |
| 203 | initializeLibxml2(void) { |
| 204 | xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); |
| 205 | xmlInitParser(); |
| 206 | xmlSetExternalEntityLoader(testExternalEntityLoader); |
| 207 | ctxtXPath = xmlXPathNewContext(NULL); |
| 208 | /* |
| 209 | * Deactivate the cache if created; otherwise we have to create/free it |
| 210 | * for every test, since it will confuse the memory leak detection. |
| 211 | * Note that normally this need not be done, since the cache is not |
| 212 | * created until set explicitly with xmlXPathContextSetCache(); |
| 213 | * but for test purposes it is sometimes useful to activate the |
| 214 | * cache by default for the whole library. |
| 215 | */ |
| 216 | if (ctxtXPath->cache != NULL) |
| 217 | xmlXPathContextSetCache(ctxtXPath, 0, -1, 0); |
| 218 | /* used as default namespace in xstc tests */ |
| 219 | xmlXPathRegisterNs(ctxtXPath, BAD_CAST "ts", BAD_CAST "TestSuite"); |
| 220 | xmlXPathRegisterNs(ctxtXPath, BAD_CAST "xlink", |
| 221 | BAD_CAST "http://www.w3.org/1999/xlink"); |
| 222 | xmlSetGenericErrorFunc(NULL, testErrorHandler); |
| 223 | #ifdef LIBXML_SCHEMAS_ENABLED |
| 224 | xmlSchemaInitTypes(); |
| 225 | xmlRelaxNGInitTypes(); |
| 226 | #endif |
| 227 | } |
| 228 | |
| 229 | static xmlNodePtr |
| 230 | getNext(xmlNodePtr cur, const char *xpath) { |
no test coverage detected