From: Ilya M. <m_...@us...> - 2003-03-25 20:05:24
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext In directory sc8-pr-cvs1:/tmp/cvs-serv30172 Modified Files: XPathContext.xs Log Message: Use XPathContext: prefix in all croak messages Don't add \n at the end of croak messages so croak doesn't suppress file and line number info in error message. Index: XPathContext.xs =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/XPathContext.xs,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- XPathContext.xs 24 Mar 2003 09:26:48 -0000 1.21 +++ XPathContext.xs 25 Mar 2003 20:05:15 -0000 1.22 @@ -210,12 +210,12 @@ data = (SV *) varLookupData; if (varLookupData == NULL || !SvROK(data) || SvTYPE(SvRV(data)) != SVt_PVAV) { - croak("XPathContext: lost variable lookup data structure!\n"); + croak("XPathContext: lost variable lookup data structure!"); } lookup_func = av_fetch((AV *) SvRV(data),0,0 ); if ( lookup_func == NULL || !SvROK(*lookup_func) || SvTYPE(SvRV(*lookup_func)) != SVt_PVCV ) { - croak("XPathContext: lost variable lookup function!\n"); + croak("XPathContext: lost variable lookup function!"); } lookup_data = av_fetch((AV *) SvRV(data),1,0 ); @@ -233,9 +233,9 @@ SPAGAIN; if (SvTRUE(ERRSV)) { POPs; - croak("XPathContext: error coming back from variable lookup function. %s\n", SvPV_nolen(ERRSV)); + croak("XPathContext: error coming back from variable lookup function. %s", SvPV_nolen(ERRSV)); } - if (count != 1) croak("XPathContext: variable lookup function returned more than one argument!\n"); + if (count != 1) croak("XPathContext: variable lookup function returned more than one argument!"); ret = LibXML_perldata_to_LibXMLdata(NULL, POPs); @@ -271,7 +271,7 @@ data = (SV *) ctxt->context->funcLookupData; if (ctxt->context->funcLookupData == NULL || !SvROK(data) || SvTYPE(SvRV(data)) != SVt_PVHV) { - croak("XPathContext: lost function lookup data structure!\n"); + croak("XPathContext: lost function lookup data structure!"); } function = ctxt->context->function; @@ -289,7 +289,7 @@ hv_fetch((HV*)SvRV(data), strkey, len, 0); if ( perl_function == NULL || !SvROK(*perl_function) || SvTYPE(SvRV(*perl_function)) != SVt_PVCV ) { - croak("XPathContext: lost perl extension function!\n"); + croak("XPathContext: lost perl extension function!"); } SvREFCNT_dec(key); @@ -384,10 +384,10 @@ if (SvTRUE(ERRSV)) { POPs; - croak("XPathContext: error coming back from perl-dispatcher in pm file. %s\n", SvPV_nolen(ERRSV)); + croak("XPathContext: error coming back from perl-dispatcher in pm file. %s", SvPV_nolen(ERRSV)); } - if (count != 1) croak("XPathContext: perl-dispatcher in pm file returned more than one argument!\n"); + if (count != 1) croak("XPathContext: perl-dispatcher in pm file returned more than one argument!"); ret = LibXML_perldata_to_LibXMLdata(ctxt, POPs); @@ -495,7 +495,7 @@ INIT: xmlXPathContextPtr ctxt = (xmlXPathContextPtr)SvIV(SvRV(self)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); CODE: @@ -504,7 +504,7 @@ PmmOWNERPO( PmmPROXYNODE(ctxt->node))); } else { - warn("XPathContext: lost context node\n"); + croak("XPathContext: lost context node"); RETVAL = &PL_sv_undef; } OUTPUT: @@ -517,7 +517,7 @@ INIT: xmlXPathContextPtr ctxt = (xmlXPathContextPtr)SvIV(SvRV(self)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } PPCODE: if (XPathContextDATA(ctxt)->node) { @@ -537,13 +537,13 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); PPCODE: ret = xmlXPathRegisterNs(ctxt, prefix, ns_uri); if(ret == -1) { - croak( "cannot register ns" ); + croak("XPathContext:cannot register namespace"); } SV* @@ -553,7 +553,7 @@ SV ** lookup_data; xmlXPathContextPtr ctxt = (xmlXPathContextPtr)SvIV(SvRV(self)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); CODE: @@ -587,7 +587,7 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); if ( SvROK(lookup_func) && SvTYPE(SvRV(lookup_func)) == SVt_PVCV ) { @@ -595,7 +595,7 @@ av_push((AV *)SvRV(pfdr), SvREFCNT_inc(lookup_func)); av_push((AV *)SvRV(pfdr), SvREFCNT_inc(lookup_data)); } else { - croak( "1st argument is not a CODE reference" ); + croak("XPathContext: 1st argument is not a CODE reference"); } if (ctxt->varLookupData != NULL) { if (SvTYPE(SvRV((SV *)ctxt->varLookupData)) == SVt_PVAV) { @@ -603,13 +603,13 @@ ctxt->varLookupData = NULL; ctxt->varLookupFunc = NULL; } else { - croak("can't register: varLookupData slot already occupied\n"); + croak("XPathContext: cannot register: varLookupData slot already occupied"); } } PPCODE: xmlXPathRegisterVariableLookup(ctxt, LibXML_generic_variable_lookup, pfdr); if (ctxt->varLookupData==NULL || ctxt->varLookupData != pfdr) { - croak( "registrating failed\n" ); + croak( "XPathContext: registration failure" ); } void @@ -628,7 +628,7 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); if ( SvTYPE(SvRV(func)) == SVt_PVCV ) { @@ -640,7 +640,7 @@ /* good, it's a HV */ pfdr = (SV *)ctxt->funcLookupData; } else { - croak ( "can't register: funcLookupData structure occupied\n" ); + croak ("XPathContext: cannot register: funcLookupData structure occupied"); } } key = newSVpvn("",0); @@ -655,7 +655,7 @@ hv_store((HV *)SvRV(pfdr),strkey, len, SvREFCNT_inc(func), 0); SvREFCNT_dec(key); } else { - croak( "function is not a CODE reference\n" ); + croak("XPathContext: 3rd argument is not a CODE reference"); } PPCODE: if (SvOK(uri)) { @@ -674,11 +674,11 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "XPathContext: missing xpath context" ); + croak("XPathContext: missing xpath context"); } PPCODE: if ( XPathContextDATA(ctxt)->lock != 0 ) { - croak( "XPathContext: context is locked" ); + croak("XPathContext: context is locked"); } XPathContextDATA(ctxt)->lock=1; @@ -690,7 +690,7 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } PPCODE: XPathContextDATA(ctxt)->lock=0; @@ -713,18 +713,17 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); if ( ctxt->node == NULL ) { - croak( "lost node" ); + croak("XPathContext: lost current node"); } xpath = nodeSv2C(perl_xpath, ctxt->node); if ( !(xpath && xmlStrlen(xpath)) ) { - xs_warn( "bad xpath\n" ); if ( xpath ) xmlFree(xpath); - croak( "empty XPath found" ); + croak("XPathContext: empty XPath found"); XSRETURN_UNDEF; } PPCODE: @@ -806,18 +805,17 @@ INIT: ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); if ( ctxt == NULL ) { - croak( "missing xpath context" ); + croak("XPathContext: missing xpath context"); } LibXML_configure_xpathcontext(ctxt); if ( ctxt->node == NULL ) { - croak( "lost node" ); + croak("XPathContext: lost current node"); } xpath = nodeSv2C(pxpath, ctxt->node); if ( !(xpath && xmlStrlen(xpath)) ) { - xs_warn( "bad xpath\n" ); if ( xpath ) xmlFree(xpath); - croak( "empty XPath found" ); + croak("XPathContext: empty XPath found"); XSRETURN_UNDEF; } |