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

Function xmlACatalogAdd

ThirdParty/libxml2/vtklibxml2/catalog.c:2922–2950  ·  view source on GitHub ↗

* xmlACatalogAdd: * @catal: a Catalog * @type: the type of record to add to the catalog * @orig: the system, public or prefix to match * @replace: the replacement value for the match * * Add an entry in the catalog, it may overwrite existing but * different entries. * * Returns 0 if successful, -1 otherwise */

Source from the content-addressed store, hash-verified

2920 * Returns 0 if successful, -1 otherwise
2921 */
2922int
2923xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type,
2924 const xmlChar * orig, const xmlChar * replace)
2925{
2926 int res = -1;
2927
2928 if (catal == NULL)
2929 return(-1);
2930
2931 if (catal->type == XML_XML_CATALOG_TYPE) {
2932 res = xmlAddXMLCatalog(catal->xml, type, orig, replace);
2933 } else {
2934 xmlCatalogEntryType cattype;
2935
2936 cattype = xmlGetSGMLCatalogEntryType(type);
2937 if (cattype != XML_CATA_NONE) {
2938 xmlCatalogEntryPtr entry;
2939
2940 entry = xmlNewCatalogEntry(cattype, orig, replace, NULL,
2941 XML_CATA_PREFER_NONE, NULL);
2942 if (catal->sgml == NULL)
2943 catal->sgml = xmlHashCreate(10);
2944 res = xmlHashAddEntry(catal->sgml, orig, entry);
2945 if (res < 0)
2946 xmlFreeCatalogEntry(entry, NULL);
2947 }
2948 }
2949 return (res);
2950}
2951
2952/**
2953 * xmlACatalogRemove:

Callers 2

xmlCatalogAddFunction · 0.85
mainFunction · 0.85

Calls 5

xmlAddXMLCatalogFunction · 0.85
xmlHashCreateFunction · 0.85
xmlHashAddEntryFunction · 0.85
xmlFreeCatalogEntryFunction · 0.85

Tested by

no test coverage detected