diff options
Diffstat (limited to 'LibXML.xs')
-rw-r--r-- | LibXML.xs | 55 |
1 files changed, 21 insertions, 34 deletions
@@ -4025,18 +4025,11 @@ is_valid(self, ...) CODE: INIT_ERROR_HANDLER; + memset(&cvp, 0, sizeof(cvp)); cvp.userData = saved_error; cvp.error = (xmlValidityErrorFunc)LibXML_validity_error_ctx; cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning_ctx; - /* we need to initialize the node stack, because perl might - * already have messed it up. - */ - cvp.nodeNr = 0; - cvp.nodeTab = NULL; - cvp.vstateNr = 0; - cvp.vstateTab = NULL; - PmmClearPSVI(self); PmmInvalidatePSVI(self); if (items > 1) { @@ -4065,16 +4058,10 @@ validate(self, ...) CODE: INIT_ERROR_HANDLER; + memset(&cvp, 0, sizeof(cvp)); cvp.userData = saved_error; cvp.error = (xmlValidityErrorFunc)LibXML_validity_error_ctx; cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning_ctx; - /* we need to initialize the node stack, because perl might - * already have messed it up. - */ - cvp.nodeNr = 0; - cvp.nodeTab = NULL; - cvp.vstateNr = 0; - cvp.vstateTab = NULL; PmmClearPSVI(self); PmmInvalidatePSVI(self); @@ -5747,7 +5734,7 @@ _setNamespace(self, namespaceURI, namespacePrefix = &PL_sv_undef, flag = 1 ) CODE: /* if ( !nsURI ){ XSRETURN_UNDEF; - } */ + } */ nsPrefix = nodeSv2C(namespacePrefix, node); if ( xmlStrlen( nsPrefix ) == 0 ) { @@ -5759,22 +5746,22 @@ _setNamespace(self, namespaceURI, namespacePrefix = &PL_sv_undef, flag = 1 ) nsURI = NULL; } if ( nsPrefix == NULL && nsURI == NULL ) { - /* special case: empty namespace */ - if ( (ns = xmlSearchNs(node->doc, node, NULL)) && - ( ns->href && xmlStrlen( ns->href ) != 0 ) ) { - /* won't take it */ - RETVAL = 0; - } else if ( flag ) { - /* no namespace */ - xmlSetNs(node, NULL); - RETVAL = 1; - } else { - RETVAL = 0; - } - } + /* special case: empty namespace */ + if ( (ns = xmlSearchNs(node->doc, node, NULL)) && + ( ns->href && xmlStrlen( ns->href ) != 0 ) ) { + /* won't take it */ + RETVAL = 0; + } else if ( flag ) { + /* no namespace */ + xmlSetNs(node, NULL); + RETVAL = 1; + } else { + RETVAL = 0; + } + } else if ( flag && (ns = xmlSearchNs(node->doc, node, nsPrefix)) ) { - /* user just wants to set the namespace for the node */ - /* try to reuse an existing declaration for the prefix */ + /* user just wants to set the namespace for the node */ + /* try to reuse an existing declaration for the prefix */ if ( xmlStrEqual( ns->href, nsURI ) ) { RETVAL = 1; } @@ -5786,9 +5773,9 @@ _setNamespace(self, namespaceURI, namespacePrefix = &PL_sv_undef, flag = 1 ) } } else if ( (ns = xmlNewNs( node, nsURI, nsPrefix )) ) - RETVAL = 1; - else - RETVAL = 0; + RETVAL = 1; + else + RETVAL = 0; if ( flag && ns ) { xmlSetNs(node, ns); |