* xmlLoadCatalog: * @filename: a file path * * Load the catalog and makes its definitions effective for the default * external entity loader. It will recurse in SGML CATALOG entries. * this function is not thread safe, catalog initialization should * preferably be done once at startup * * Returns 0 in case of success -1 in case of error */
| 3132 | * Returns 0 in case of success -1 in case of error |
| 3133 | */ |
| 3134 | int |
| 3135 | xmlLoadCatalog(const char *filename) |
| 3136 | { |
| 3137 | int ret; |
| 3138 | xmlCatalogPtr catal; |
| 3139 | |
| 3140 | if (!xmlCatalogInitialized) |
| 3141 | xmlInitializeCatalogData(); |
| 3142 | |
| 3143 | xmlRMutexLock(xmlCatalogMutex); |
| 3144 | |
| 3145 | if (xmlDefaultCatalog == NULL) { |
| 3146 | catal = xmlLoadACatalog(filename); |
| 3147 | if (catal == NULL) { |
| 3148 | xmlRMutexUnlock(xmlCatalogMutex); |
| 3149 | return(-1); |
| 3150 | } |
| 3151 | |
| 3152 | xmlDefaultCatalog = catal; |
| 3153 | xmlRMutexUnlock(xmlCatalogMutex); |
| 3154 | return(0); |
| 3155 | } |
| 3156 | |
| 3157 | ret = xmlExpandCatalog(xmlDefaultCatalog, filename); |
| 3158 | xmlRMutexUnlock(xmlCatalogMutex); |
| 3159 | return(ret); |
| 3160 | } |
| 3161 | |
| 3162 | /** |
| 3163 | * xmlLoadCatalogs: |