[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [xml] [PATCH] make all errors go through xmlGenericError



On Wed, Mar 14, 2001 at 07:47:32PM +0000, Matt Sergeant wrote:
> I had some errors going to stderr, even when I had my own error handler
> defined.

  Hum, right good catch ...

> This patch fixes that. I'm not sure if this is exactly how
> varargs are meant to be passed to other functions, but it appears to work.

  When "make tests" makes the terminal echo funny and blinking chars
it means something si wrong :-)
  So no, varargs need some special handling. the enclosed patch should
apply cleanly on 2.3.4 and fix the problem,

  thanks for the report,

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
*** error.c	2001/03/10 12:32:01	1.20
--- error.c	2001/03/14 20:09:58
***************
*** 214,220 ****
      str = xmlGetVarStr(msg, args);
      va_end(args);
      xmlGenericError(xmlGenericErrorContext, str);
!     xmlFree(str);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
--- 214,221 ----
      str = xmlGetVarStr(msg, args);
      va_end(args);
      xmlGenericError(xmlGenericErrorContext, str);
!     if (str != NULL)
! 	xmlFree(str);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
***************
*** 259,265 ****
      str = xmlGetVarStr(msg, args);
      va_end(args);
      xmlGenericError(xmlGenericErrorContext, str);
!     xmlFree(str);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
--- 260,267 ----
      str = xmlGetVarStr(msg, args);
      va_end(args);
      xmlGenericError(xmlGenericErrorContext, str);
!     if (str != NULL)
! 	xmlFree(str);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
***************
*** 291,296 ****
--- 293,299 ----
  {
      xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
      xmlParserInputPtr input = NULL;
+     char * str;
      va_list args;
  
      if (ctxt != NULL) {
***************
*** 303,310 ****
  
      xmlGenericError(xmlGenericErrorContext, "validity error: ");
      va_start(args, msg);
!     vfprintf(xmlGenericErrorContext, msg, args);
      va_end(args);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
--- 306,316 ----
  
      xmlGenericError(xmlGenericErrorContext, "validity error: ");
      va_start(args, msg);
!     str = xmlGetVarStr(msg, args);
      va_end(args);
+     xmlGenericError(xmlGenericErrorContext, str);
+     if (str != NULL)
+ 	xmlFree(str);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
***************
*** 325,330 ****
--- 331,337 ----
  {
      xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
      xmlParserInputPtr input = NULL;
+     char * str;
      va_list args;
  
      if (ctxt != NULL) {
***************
*** 337,344 ****
          
      xmlGenericError(xmlGenericErrorContext, "validity warning: ");
      va_start(args, msg);
!     vfprintf(xmlGenericErrorContext, msg, args);
      va_end(args);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);
--- 344,354 ----
          
      xmlGenericError(xmlGenericErrorContext, "validity warning: ");
      va_start(args, msg);
!     str = xmlGetVarStr(msg, args);
      va_end(args);
+     xmlGenericError(xmlGenericErrorContext, str);
+     if (str != NULL)
+ 	xmlFree(str);
  
      if (ctxt != NULL) {
  	xmlParserPrintFileContext(input);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]