[cig-commits] commit: Replacing a Journal_Firewall call, that kills the code if a xml file isn't found, a Journal_DPrintf and an exit(). The latter approach isn't precompiled out.

Mercurial hg at geodynamics.org
Mon Feb 1 15:33:33 PST 2010


changeset:   761:ee50858f535d
branch:      1.4.x
user:        JulianGiordani
date:        Mon Jan 11 14:05:41 2010 +1100
files:       Base/IO/src/XML_IO_Handler.c
description:
Replacing a Journal_Firewall call, that kills the code if a xml file isn't found, a Journal_DPrintf and an exit(). The latter approach isn't precompiled out.


diff -r a82af7b11c05 -r ee50858f535d Base/IO/src/XML_IO_Handler.c
--- a/Base/IO/src/XML_IO_Handler.c	Mon Jan 11 14:01:08 2010 +1100
+++ b/Base/IO/src/XML_IO_Handler.c	Mon Jan 11 14:05:41 2010 +1100
@@ -691,40 +691,42 @@ Bool _XML_IO_Handler_ReadAllFromBuffer( 
  * \return a pointer to the root node if the file is valid, NULL otherwise. */
 static xmlNodePtr _XML_IO_Handler_OpenCheckFile( XML_IO_Handler* self, const char* filename )
 {
-	xmlChar		absolute[1024];
-	xmlNodePtr	cur = NULL;
-	Bool			status = False;
+   xmlChar		absolute[1024];
+   xmlNodePtr	cur = NULL;
+   Bool			status = False;
 
-	if ( FindFileInPathList(
-		(char*)absolute,
-		(char*)filename,
-		self->searchPaths,
-		self->searchPathsSize ) )
-	{
-		_XML_IO_Handler_OpenFile( self, (char*)absolute );
-	}
+   if ( FindFileInPathList(
+      (char*)absolute,
+      (char*)filename,
+      self->searchPaths,
+      self->searchPathsSize ) )
+   {
+      _XML_IO_Handler_OpenFile( self, (char*)absolute );
+   }
 
-	Journal_Firewall( self->currDoc != NULL,
-		Journal_Register( Error_Type, XML_IO_Handler_Type ),
-		"Error: File %s doesn't exist, not readable, or not valid.\n",
-		filename );
-	
-	if( self->currDoc != NULL ) {
-		cur = xmlDocGetRootElement( self->currDoc );
-		status = _XML_IO_Handler_Check( self, self->currDoc );
+   if( self->currDoc == NULL ) {
+      Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+      "Error: File %s doesn't exist, not readable, or not valid.\n", filename );
+      exit(EXIT_FAILURE);
+   }
 
-		Journal_Firewall( status,
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Error: File %s not valid/readable.\n",
-			filename );
+   if( self->currDoc != NULL ) {
+      cur = xmlDocGetRootElement( self->currDoc );
+      status = _XML_IO_Handler_Check( self, self->currDoc );
 
-		if( status == True )
-			return cur;
-		else
-			return NULL;
-	}
-	else
-		return NULL; 
+      if( !status ) {
+         Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+         "Error: File %s not valid/readable.\n", filename );
+         exit(EXIT_FAILURE);
+      }
+
+      if( status == True )
+         return cur;
+      else
+         return NULL;
+   }
+   else
+      return NULL; 
 }
 
 static xmlNodePtr _XML_IO_Handler_OpenCheckBuffer( XML_IO_Handler* self, const char* buffer ) {



More information about the CIG-COMMITS mailing list