MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlInitializeCatalog

Function xmlInitializeCatalog

ThirdParty/libxml2/vtklibxml2/catalog.c:3069–3120  ·  view source on GitHub ↗

* xmlInitializeCatalog: * * Do the catalog initialization. * this function is not thread safe, catalog initialization should * preferably be done once at startup */

Source from the content-addressed store, hash-verified

3067 * preferably be done once at startup
3068 */
3069void
3070xmlInitializeCatalog(void) {
3071 if (xmlCatalogInitialized != 0)
3072 return;
3073
3074 xmlInitializeCatalogData();
3075 xmlRMutexLock(xmlCatalogMutex);
3076
3077 if (getenv("XML_DEBUG_CATALOG"))
3078 xmlDebugCatalogs = 1;
3079
3080 if (xmlDefaultCatalog == NULL) {
3081 const char *catalogs;
3082 char *path;
3083 const char *cur, *paths;
3084 xmlCatalogPtr catal;
3085 xmlCatalogEntryPtr *nextent;
3086
3087 catalogs = (const char *) getenv("XML_CATALOG_FILES");
3088 if (catalogs == NULL)
3089 catalogs = XML_XML_DEFAULT_CATALOG;
3090
3091 catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
3092 xmlCatalogDefaultPrefer);
3093 if (catal != NULL) {
3094 /* the XML_CATALOG_FILES envvar is allowed to contain a
3095 space-separated list of entries. */
3096 cur = catalogs;
3097 nextent = &catal->xml;
3098 while (*cur != '\0') {
3099 while (xmlIsBlank_ch(*cur))
3100 cur++;
3101 if (*cur != 0) {
3102 paths = cur;
3103 while ((*cur != 0) && (!xmlIsBlank_ch(*cur)))
3104 cur++;
3105 path = (char *) xmlStrndup((const xmlChar *)paths, cur - paths);
3106 if (path != NULL) {
3107 *nextent = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
3108 NULL, BAD_CAST path, xmlCatalogDefaultPrefer, NULL);
3109 if (*nextent != NULL)
3110 nextent = &((*nextent)->next);
3111 xmlFree(path);
3112 }
3113 }
3114 }
3115 xmlDefaultCatalog = catal;
3116 }
3117 }
3118
3119 xmlRMutexUnlock(xmlCatalogMutex);
3120}
3121
3122
3123/**

Callers 14

xmlCatalogResolveSystemFunction · 0.85
xmlCatalogResolvePublicFunction · 0.85
xmlCatalogResolveFunction · 0.85
xmlCatalogResolveURIFunction · 0.85
xmlCatalogDumpFunction · 0.85
xmlCatalogRemoveFunction · 0.85
xmlCatalogConvertFunction · 0.85
xmlCatalogFreeLocalFunction · 0.85
xmlCatalogAddLocalFunction · 0.85
xmlCatalogLocalResolveFunction · 0.85
xmlCatalogGetSystemFunction · 0.85

Calls 5

xmlInitializeCatalogDataFunction · 0.85
xmlRMutexLockFunction · 0.85
xmlCreateNewCatalogFunction · 0.85
xmlStrndupFunction · 0.85
xmlRMutexUnlockFunction · 0.85

Tested by

no test coverage detected