From: Petr P. <pa...@us...> - 2003-03-14 17:20:55
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext In directory sc8-pr-cvs1:/tmp/cvs-serv21066 Modified Files: XPathContext.xs Log Message: fixed problem with undefined uri in registerFunctionNS Index: XPathContext.xs =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/XPathContext.xs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- XPathContext.xs 14 Mar 2003 16:23:50 -0000 1.3 +++ XPathContext.xs 14 Mar 2003 17:20:47 -0000 1.4 @@ -534,7 +534,7 @@ registerFunctionNS( pxpath_context, name, uri, func) SV * pxpath_context char * name - char * uri + SV * uri SV * func PREINIT: xmlXPathContextPtr ctxt = NULL; @@ -561,9 +561,9 @@ } } key = newSVpvn("",0); - if (uri && *uri) { + if (SvOK(uri)) { sv_catpv(key, "{"); - sv_catpv(key, (const char*)uri); + sv_catsv(key, uri); sv_catpv(key, "}"); } sv_catpv(key, (const char*)name); @@ -575,13 +575,13 @@ croak( "function is not a CODE reference\n" ); } PPCODE: - if (uri && *uri) { - /* warn("Registering function with NS '%s' (uri: %s)\n", name, uri); */ - xmlXPathRegisterFuncNS(ctxt, name, uri, LibXML_generic_extension_function); - } else { - /* warn("Registering function '%s'\n", name); */ - xmlXPathRegisterFunc(ctxt, name, LibXML_generic_extension_function); - } + if (SvOK(uri)) { + /* warn("Registering function with NS '%s' (uri: %s)\n", name, uri); */ + xmlXPathRegisterFuncNS(ctxt, name, SvPV(uri, len), LibXML_generic_extension_function); + } else { + /* warn("Registering function '%s'\n", name); */ + xmlXPathRegisterFunc(ctxt, name, LibXML_generic_extension_function); + } void _findnodes( pxpath_context, perl_xpath ) |