* We need to trap calls to the resolver to not account memory for the catalog * which is shared to the current running test. We also don't want to have * network downloads modifying tests. */
| 119 | * network downloads modifying tests. |
| 120 | */ |
| 121 | static xmlParserInputPtr |
| 122 | testExternalEntityLoader(const char *URL, const char *ID, |
| 123 | xmlParserCtxtPtr ctxt) { |
| 124 | xmlParserInputPtr ret; |
| 125 | int i; |
| 126 | |
| 127 | for (i = 0;i < nb_entities;i++) { |
| 128 | if (!strcmp(testEntitiesName[i], URL)) { |
| 129 | ret = xmlNewStringInputStream(ctxt, |
| 130 | (const xmlChar *) testEntitiesValue[i]); |
| 131 | if (ret != NULL) { |
| 132 | ret->filename = (const char *) |
| 133 | xmlStrdup((xmlChar *)testEntitiesName[i]); |
| 134 | } |
| 135 | return(ret); |
| 136 | } |
| 137 | } |
| 138 | if (checkTestFile(URL)) { |
| 139 | ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); |
| 140 | } else { |
| 141 | int memused = xmlMemUsed(); |
| 142 | ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); |
| 143 | extraMemoryFromResolver += xmlMemUsed() - memused; |
| 144 | } |
| 145 | #if 0 |
| 146 | if (ret == NULL) { |
| 147 | fprintf(stderr, "Failed to find resource %s\n", URL); |
| 148 | } |
| 149 | #endif |
| 150 | |
| 151 | return(ret); |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | * Trapping the error messages at the generic level to grab the equivalent of |
nothing calls this directly
no test coverage detected