Commits

Anonymous committed 6001ba6

fixed several HAVE_SERROR to correct HAVE_SERRORS

  • Participants
  • Parent commits 4719a44
  • Branches structerror

Comments (0)

Files changed (1)

         LibXML_init_error(&saved_error);
 
         cvp.userData = (void*)PerlIO_stderr();
-#ifdef HAVE_SERROR
+#ifdef HAVE_SERRORS
         cvp.error = NULL;
         cvp.warning = NULL;
 #else
         cvp.error = (xmlValidityErrorFunc)LibXML_validity_error;
         cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning;
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
 
         /* we need to initialize the node stack, because perl might
          * already have messed it up.
         LibXML_init_error(&saved_error);
 
         cvp.userData = (void*)PerlIO_stderr();
-#ifdef HAVE_SERROR
+#ifdef HAVE_SERRORS
         cvp.error = NULL;
         cvp.warning = NULL;
 #else
         cvp.error = (xmlValidityErrorFunc)LibXML_validity_error;
         cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning;
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         /* we need to initialize the node stack, because perl might
          * already have messed it up.
          */
         }
 
         /* Register Error callbacks */
-#ifndef HAVE_SERROR
+#ifndef HAVE_SERRORS
         xmlRelaxNGSetParserErrors( rngctxt,
                                   (xmlRelaxNGValidityErrorFunc)LibXML_error_handler,
                                   (xmlRelaxNGValidityWarningFunc)LibXML_error_handler,
                                   rngctxt );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlRelaxNGParse( rngctxt );
         xmlRelaxNGFreeParserCtxt( rngctxt );
 
         }
 
         /* Register Error callbacks */
-#ifndef HAVE_SERROR
+#ifndef HAVE_SERRORS
         xmlRelaxNGSetParserErrors( rngctxt,
                                   (xmlRelaxNGValidityErrorFunc)LibXML_error_handler,
                                   (xmlRelaxNGValidityWarningFunc)LibXML_error_handler,
                                   rngctxt );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlRelaxNGParse( rngctxt );
         xmlRelaxNGFreeParserCtxt( rngctxt );
 
         }
 
         /* Register Error callbacks */
-#ifndef HAVE_SERROR
+#ifndef HAVE_SERRORS
         xmlRelaxNGSetParserErrors( rngctxt,
                                   (xmlRelaxNGValidityErrorFunc)  LibXML_error_handler,
                                   (xmlRelaxNGValidityWarningFunc)LibXML_error_handler,
                                   rngctxt );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlRelaxNGParse( rngctxt );
         xmlRelaxNGFreeParserCtxt( rngctxt );
 
         if ( vctxt == NULL ) {
             croak( "cannot initialize the validation context" );
         }
-#ifndef HAVE_SERROR
+#ifndef HAVE_SERRORS
         /* Register Error callbacks */
         xmlRelaxNGSetValidErrors( vctxt,
                                   (xmlRelaxNGValidityErrorFunc)LibXML_error_handler,
                                   (xmlRelaxNGValidityWarningFunc)LibXML_error_handler,
                                   vctxt );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlRelaxNGValidateDoc( vctxt, doc );
         xmlRelaxNGFreeValidCtxt( vctxt );
 
         LibXML_report_error(saved_error, 0);
-#ifdef HAVE_SERROR
-            LibXML_croak_error();
-            croak( "validation failed\n" );
-#else
-	    if ( LibXML_error_OK && SvCUR( LibXML_error ) > 0 ) {
-               croak("validate error: %s",SvPV_nolen(LibXML_error));
-            } else {
-	       /* not valid, although libxml2 gave no reason */
- 	       croak( "validation failed\n" );
-	    }
-#endif /* HAVE_SERROR */
+        if (RETVAL>1) {
+	  /* not valid, although libxml2 gave no reason */
+          croak( "validation failed for unknown reason\n" );
+          XSRETURN_UNDEF;
+        }
         if ( RETVAL == -1 ) {
             croak( "API Error" );
             XSRETURN_UNDEF;
         if ( rngctxt == NULL ) {
             croak( "failed to initialize Schema parser" );
         }
-#ifdef HAVE_SERROR
+#ifdef HAVE_SERRORS
         /* Register Error callbacks */
         xmlSchemaSetParserErrors( rngctxt,
                                   (xmlSchemaValidityErrorFunc)LibXML_error_handler,
                                   (xmlSchemaValidityWarningFunc)LibXML_error_handler,
                                   rngctxt );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlSchemaParse( rngctxt );
         xmlSchemaFreeParserCtxt( rngctxt );
 
         if ( rngctxt == NULL ) {
             croak( "failed to initialize Schema parser" );
         }
-#ifdef HAVE_SERROR
+#ifdef HAVE_SERRORS
         /* Register Error callbacks */
         xmlSchemaSetParserErrors( rngctxt,
                                   (xmlSchemaValidityErrorFunc)LibXML_error_handler,
                                   (xmlSchemaValidityWarningFunc)LibXML_error_handler,
                                   NULL );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlSchemaParse( rngctxt );
         xmlSchemaFreeParserCtxt( rngctxt );
 
         if ( vctxt == NULL ) {
             croak( "cannot initialize the validation context" );
         }
-#ifdef HAVE_SERROR
+#ifdef HAVE_SERRORS
         /* Register Error callbacks */
         xmlSchemaSetValidErrors( vctxt,
                                   (xmlSchemaValidityErrorFunc)LibXML_error_handler,
                                   (xmlSchemaValidityWarningFunc)LibXML_error_handler,
                                   NULL );
-#endif /* HAVE_SERROR */
+#endif /* HAVE_SERRORS */
         RETVAL = xmlSchemaValidateDoc( vctxt, doc );
         xmlSchemaFreeValidCtxt( vctxt );
 
         LibXML_report_error(saved_error, 0);
         if ( RETVAL > 0 ) {
-#ifdef HAVE_SERROR
-            LibXML_croak_error();
-            croak( "validation failed\n" );
-#else
-	    if ( LibXML_error_OK && SvCUR( LibXML_error ) > 0 ) {
-               croak("validate error: %s",SvPV_nolen(LibXML_error));
-            } else {
-	       /* not valid, although libxml2 gave no reason */
- 	       croak( "validation failed\n" );
-	    }
-#endif /* HAVE_SERROR */
+            croak( "validation failed for unknown reason\n" );
             XSRETURN_UNDEF;
         }
         if ( RETVAL == -1 ) {