debug: Simplify Debug1
authorChristof Schmitt <cs@samba.org>
Fri, 9 Jan 2015 22:00:04 +0000 (15:00 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 23 Mar 2015 20:22:11 +0000 (21:22 +0100)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
lib/util/debug.c

index 806138a05627dbefe02ac2bd4e1ce9c1b039cba5..8e08fcdf7f267492ae84b2a419a7112dbdc11fa4 100644 (file)
@@ -1018,33 +1018,32 @@ void check_log_size( void )
  This is called by dbghdr() and format_debug_text().
 ************************************************************************/
 
-static int Debug1(const char *msg)
+static void Debug1(const char *msg)
 {
        int old_errno = errno;
 
        debug_count++;
 
-       if (state.logtype == DEBUG_CALLBACK) {
+       switch(state.logtype) {
+       case DEBUG_CALLBACK:
                debug_callback_log(msg, current_msg_level);
-               goto done;
-       }
-
-       if ( state.logtype != DEBUG_FILE ) {
+               break;
+       case DEBUG_STDOUT:
+       case DEBUG_STDERR:
+       case DEBUG_DEFAULT_STDOUT:
+       case DEBUG_DEFAULT_STDERR:
                if (state.fd > 0) {
                        write(state.fd, msg, strlen(msg));
                }
-               goto done;
-       }
-
-       debug_backends_log(msg, current_msg_level);
+               break;
+       case DEBUG_FILE:
+               debug_backends_log(msg, current_msg_level);
+               break;
+       };
 
- done:
        errno = old_errno;
-
-       return( 0 );
 }
 
-
 /**************************************************************************
  Print the buffer content via Debug1(), then reset the buffer.
  Input:  none