From 9026820e5cadc1f42ca2d88fdb53c0c715e2f221 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 Jul 2014 12:58:53 +0000 Subject: [PATCH] debug: Statically allocate format_bufr Everybody needs this, so there's no point talloc'ing it. The side effect is that it removes a dependency on smb_panic() Signed-off-by: Volker Lendecke Reviewed-by: Michael Adam --- lib/util/debug.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/util/debug.c b/lib/util/debug.c index 013f34c2c5f..ffd8e035eb7 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -142,7 +142,7 @@ int *DEBUGLEVEL_CLASS = discard_const_p(int, debug_class_list_initial); static int debug_count = 0; static int current_msg_level = 0; -static char *format_bufr = NULL; +static char format_bufr[FORMAT_BUFR_SIZE]; static size_t format_pos = 0; static bool log_overflow = false; @@ -200,8 +200,6 @@ void gfree_debugsyms(void) DEBUGLEVEL_CLASS = discard_const_p(int, debug_class_list_initial); } - TALLOC_FREE(format_bufr); - debug_num_classes = 0; state.initialized = false; @@ -461,10 +459,6 @@ static void debug_init(void) for(p = default_classname_table; *p; p++) { debug_add_class(*p); } - format_bufr = talloc_array(NULL, char, FORMAT_BUFR_SIZE); - if (!format_bufr) { - smb_panic("debug_init: unable to create buffer"); - } } /* This forces in some smb.conf derived values into the debug system. @@ -906,9 +900,7 @@ static void format_debug_text( const char *msg ) size_t i; bool timestamp = (state.logtype == DEBUG_FILE && (state.settings.timestamp_logs)); - if (!format_bufr) { - debug_init(); - } + debug_init(); for( i = 0; msg[i]; i++ ) { /* Indent two spaces at each new line. */ -- 2.11.4.GIT