[haiku-commits] r34149 - haiku/trunk/src/add-ons/kernel/file_systems/packagefs

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 20 Nov 2009 09:14:03 +0100 (CET)

Author: bonefish
Date: 2009-11-20 09:14:03 +0100 (Fri, 20 Nov 2009)
New Revision: 34149
Changeset: http://dev.haiku-os.org/changeset/34149/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/file_systems/packagefs/DebugSupport.h
Log:
Cleanup.


Modified: haiku/trunk/src/add-ons/kernel/file_systems/packagefs/DebugSupport.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/packagefs/DebugSupport.h        
2009-11-20 08:06:05 UTC (rev 34148)
+++ haiku/trunk/src/add-ons/kernel/file_systems/packagefs/DebugSupport.h        
2009-11-20 08:14:03 UTC (rev 34149)
@@ -82,7 +82,8 @@
 
 // Short overview over the debug output macros:
 //     PRINT()
-//             is for general messages that very unlikely should appear in a 
release build
+//             is for general messages that very unlikely should appear in a 
release
+//             build
 //     FATAL()
 //             this is for fatal messages, when something has really gone wrong
 //     INFORM()
@@ -96,46 +97,79 @@
 
 
 #define DEBUG_THREAD   find_thread(NULL)
-#define DEBUG_CONTEXT(x)       { dbg_printf_begin(); __out(DEBUG_APP " [%Ld: 
%5ld] ", system_time(), DEBUG_THREAD); x; dbg_printf_end(); }
-#define DEBUG_CONTEXT_FUNCTION(prefix, x)      { dbg_printf_begin(); 
__out(DEBUG_APP " [%Ld: %5ld] %s" prefix, system_time(), DEBUG_THREAD, 
__PRETTY_FUNCTION__); x; dbg_printf_end(); }
-#define DEBUG_CONTEXT_LINE(x)  { dbg_printf_begin(); __out(DEBUG_APP " [%Ld: 
%5ld] %s:%d: ", system_time(), DEBUG_THREAD, __PRETTY_FUNCTION__, __LINE__); x; 
dbg_printf_end(); }
+#define DEBUG_CONTEXT(x)                                                       
                                                \
+{                                                                              
                                                                        \
+       dbg_printf_begin();                                                     
                                                        \
+       __out(DEBUG_APP " [%Ld: %5ld] ", system_time(), DEBUG_THREAD);          
        \
+       x;                                                                      
                                                                        \
+       dbg_printf_end();                                                       
                                                        \
+}
+#define DEBUG_CONTEXT_FUNCTION(prefix, x)                                      
                                \
+{                                                                              
                                                                        \
+       dbg_printf_begin();                                                     
                                                        \
+       __out(DEBUG_APP " [%Ld: %5ld] %s" prefix, system_time(), DEBUG_THREAD,  
\
+               __PRETTY_FUNCTION__);                                           
                                                \
+       x;                                                                      
                                                                        \
+       dbg_printf_end();                                                       
                                                        \
+}
+#define DEBUG_CONTEXT_LINE(x)                                                  
                                        \
+{                                                                              
                                                                        \
+       dbg_printf_begin();                                                     
                                                        \
+       __out(DEBUG_APP " [%Ld: %5ld] %s:%d: ", system_time(), DEBUG_THREAD,    
\
+               __PRETTY_FUNCTION__, __LINE__);                                 
                                        \
+       x;                                                                      
                                                                        \
+       dbg_printf_end();                                                       
                                                        \
+}
 
-#define TPRINT(x...) DEBUG_CONTEXT( __out(x) )
-#define TREPORT_ERROR(status) DEBUG_CONTEXT_LINE( __out("%s\n", 
strerror(status)) )
-#define TRETURN_ERROR(err) { status_t _status = err; if (_status < B_OK) 
TREPORT_ERROR(_status); return _status;}
-#define TSET_ERROR(var, err) { status_t _status = err; if (_status < B_OK) 
TREPORT_ERROR(_status); var = _status; }
-#define TFUNCTION(x...) DEBUG_CONTEXT_FUNCTION( ": ", __out(x) )
-#define TFUNCTION_START() DEBUG_CONTEXT_FUNCTION( "\n",  )
-#define TFUNCTION_END() DEBUG_CONTEXT_FUNCTION( " done\n",  )
+#define TPRINT(x...)   DEBUG_CONTEXT( __out(x) )
+#define TREPORT_ERROR(status)                                                  
                                        \
+       DEBUG_CONTEXT_LINE( __out("%s\n", strerror(status)) )
+#define TRETURN_ERROR(err)                                                     
                                                \
+{                                                                              
                                                                        \
+       status_t _status = err;                                                 
                                                \
+       if (_status < B_OK)                                                     
                                                        \
+               TREPORT_ERROR(_status);                                         
                                                \
+       return _status;                                                         
                                                        \
+}
+#define TSET_ERROR(var, err)                                                   
                                        \
+{                                                                              
                                                                        \
+       status_t _status = err;                                                 
                                                \
+       if (_status < B_OK)                                                     
                                                        \
+               TREPORT_ERROR(_status);                                         
                                                \
+               var = _status;                                                  
                                                        \
+}
+#define TFUNCTION(x...)                DEBUG_CONTEXT_FUNCTION( ": ", __out(x) )
+#define TFUNCTION_START()      DEBUG_CONTEXT_FUNCTION( "\n",  )
+#define TFUNCTION_END()                DEBUG_CONTEXT_FUNCTION( " done\n",  )
 
 #if DEBUG
-       #define PRINT(x...) TPRINT(x)
-       #define REPORT_ERROR(status) TREPORT_ERROR(status)
-       #define RETURN_ERROR(err) TRETURN_ERROR(err)
-       #define SET_ERROR(var, err) TSET_ERROR(var, err)
-       #define FATAL(x...) DEBUG_CONTEXT( __out(x) )
-       #define ERROR(x...) DEBUG_CONTEXT( __out(x) )
-       #define WARN(x...) DEBUG_CONTEXT( __out(x) )
-       #define INFORM(x...) DEBUG_CONTEXT( __out(x) )
-       #define FUNCTION(x...) TFUNCTION(x)
-       #define FUNCTION_START() TFUNCTION_START()
-       #define FUNCTION_END() TFUNCTION_END()
-       #define DARG(x) x
-       #define D(x) {x;};
+       #define PRINT(x...)                             TPRINT(x)
+       #define REPORT_ERROR(status)    TREPORT_ERROR(status)
+       #define RETURN_ERROR(err)               TRETURN_ERROR(err)
+       #define SET_ERROR(var, err)             TSET_ERROR(var, err)
+       #define FATAL(x...)                             DEBUG_CONTEXT( __out(x) 
)
+       #define ERROR(x...)                             DEBUG_CONTEXT( __out(x) 
)
+       #define WARN(x...)                              DEBUG_CONTEXT( __out(x) 
)
+       #define INFORM(x...)                    DEBUG_CONTEXT( __out(x) )
+       #define FUNCTION(x...)                  TFUNCTION(x)
+       #define FUNCTION_START()                TFUNCTION_START()
+       #define FUNCTION_END()                  TFUNCTION_END()
+       #define DARG(x)                                 x
+       #define D(x)                                    {x;};
 #else
-       #define PRINT(x...) ;
-       #define REPORT_ERROR(status) ;
-       #define RETURN_ERROR(status) return status;
-       #define SET_ERROR(var, err) var = err;
-       #define FATAL(x...) DEBUG_CONTEXT( __out(x) )
-       #define ERROR(x...) DEBUG_CONTEXT( __out(x) )
-       #define WARN(x...) DEBUG_CONTEXT( __out(x) )
-       #define INFORM(x...) DEBUG_CONTEXT( __out(x) )
-       #define FUNCTION(x...) ;
-       #define FUNCTION_START() ;
-       #define FUNCTION_END() ;
+       #define PRINT(x...)                             ;
+       #define REPORT_ERROR(status)    ;
+       #define RETURN_ERROR(status)    return status;
+       #define SET_ERROR(var, err)             var = err;
+       #define FATAL(x...)                             DEBUG_CONTEXT( __out(x) 
)
+       #define ERROR(x...)                             DEBUG_CONTEXT( __out(x) 
)
+       #define WARN(x...)                              DEBUG_CONTEXT( __out(x) 
)
+       #define INFORM(x...)                    DEBUG_CONTEXT( __out(x) )
+       #define FUNCTION(x...)                  ;
+       #define FUNCTION_START()                ;
+       #define FUNCTION_END()                  ;
        #define DARG(x)
-       #define D(x) ;
+       #define D(x)                                    ;
 #endif
 
 #ifndef TOUCH


Other related posts:

  • » [haiku-commits] r34149 - haiku/trunk/src/add-ons/kernel/file_systems/packagefs - ingo_weinhold