summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-07-29 12:58:53 +0000
committerMichael Adam <obnox@samba.org>2014-07-31 18:49:46 +0200
commit9026820e5cadc1f42ca2d88fdb53c0c715e2f221 (patch)
treeb0c718c96bf92ba83308664c643c5b30ab7ff2d4 /lib
parentdd4c019d9ffaa5453e536c8aaaa8e03463dc2959 (diff)
downloadsamba-9026820e5cadc1f42ca2d88fdb53c0c715e2f221.tar.gz
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 <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/util/debug.c12
1 files 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. */