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

Function xmlRelaxNGRegisterTypeLibrary

ThirdParty/libxml2/vtklibxml2/relaxng.c:2729–2766  ·  view source on GitHub ↗

* xmlRelaxNGRegisterTypeLibrary: * @namespace: the URI bound to the library * @data: data associated to the library * @have: the provide function * @check: the checking function * @comp: the comparison function * * Register a new type library * * Returns 0 in case of success and -1 in case of error. */

Source from the content-addressed store, hash-verified

2727 * Returns 0 in case of success and -1 in case of error.
2728 */
2729static int
2730xmlRelaxNGRegisterTypeLibrary(const xmlChar * namespace, void *data,
2731 xmlRelaxNGTypeHave have,
2732 xmlRelaxNGTypeCheck check,
2733 xmlRelaxNGTypeCompare comp,
2734 xmlRelaxNGFacetCheck facet,
2735 xmlRelaxNGTypeFree freef)
2736{
2737 xmlRelaxNGTypeLibraryPtr lib;
2738 int ret;
2739
2740 if ((xmlRelaxNGRegisteredTypes == NULL) || (namespace == NULL) ||
2741 (check == NULL) || (comp == NULL))
2742 return (-1);
2743 if (xmlHashLookup(xmlRelaxNGRegisteredTypes, namespace) != NULL)
2744 return (-1);
2745 lib =
2746 (xmlRelaxNGTypeLibraryPtr)
2747 xmlMalloc(sizeof(xmlRelaxNGTypeLibrary));
2748 if (lib == NULL) {
2749 xmlRngVErrMemory(NULL);
2750 return (-1);
2751 }
2752 memset(lib, 0, sizeof(xmlRelaxNGTypeLibrary));
2753 lib->namespace = xmlStrdup(namespace);
2754 lib->data = data;
2755 lib->have = have;
2756 lib->comp = comp;
2757 lib->check = check;
2758 lib->facet = facet;
2759 lib->freef = freef;
2760 ret = xmlHashAddEntry(xmlRelaxNGRegisteredTypes, namespace, lib);
2761 if (ret < 0) {
2762 xmlRelaxNGFreeTypeLibrary(lib, namespace);
2763 return (-1);
2764 }
2765 return (0);
2766}
2767
2768/**
2769 * xmlRelaxNGInitTypes:

Callers 1

xmlRelaxNGInitTypesFunction · 0.85

Calls 5

xmlHashLookupFunction · 0.85
xmlRngVErrMemoryFunction · 0.85
xmlStrdupFunction · 0.85
xmlHashAddEntryFunction · 0.85

Tested by

no test coverage detected