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

Function xmlXPathRegisterFuncNS

ThirdParty/libxml2/vtklibxml2/xpath.c:3923–3950  ·  view source on GitHub ↗

* xmlXPathRegisterFuncNS: * @ctxt: the XPath context * @name: the function name * @ns_uri: the function namespace URI * @f: the function implementation or NULL * * Register a new function. If @f is NULL it unregisters the function * * Returns 0 in case of success, -1 in case of error */

Source from the content-addressed store, hash-verified

3921 * Returns 0 in case of success, -1 in case of error
3922 */
3923int
3924xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name,
3925 const xmlChar *ns_uri, xmlXPathFunction f) {
3926 int ret;
3927
3928 if (ctxt == NULL)
3929 return(-1);
3930 if (name == NULL)
3931 return(-1);
3932
3933 if (ctxt->funcHash == NULL)
3934 ctxt->funcHash = xmlHashCreate(0);
3935 if (ctxt->funcHash == NULL) {
3936 xmlXPathErrMemory(ctxt);
3937 return(-1);
3938 }
3939 if (f == NULL)
3940 return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL));
3941XML_IGNORE_FPTR_CAST_WARNINGS
3942 ret = xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f);
3943XML_POP_WARNINGS
3944 if (ret < 0) {
3945 xmlXPathErrMemory(ctxt);
3946 return(-1);
3947 }
3948
3949 return(0);
3950}
3951
3952/**
3953 * xmlXPathRegisterFuncLookup:

Callers 2

xmlXPathRegisterFuncFunction · 0.85

Calls 4

xmlHashCreateFunction · 0.85
xmlXPathErrMemoryFunction · 0.85
xmlHashRemoveEntry2Function · 0.85
xmlHashAddEntry2Function · 0.85

Tested by

no test coverage detected