From db98b921449d8f3d766e5ae2696125d718054a15 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 15 Dec 2007 21:05:11 +0100 Subject: Add debug_ctx according to an idea by Tridge Sorry, Jeremy, I think for debug messages this is just the right way to do it. (This used to be commit 6312016e2727c2b5b1a4964a98cfb9585d77cc8c) --- source3/lib/debug.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 185c2373f4..87ec9ed8f5 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -90,6 +90,7 @@ bool AllowDebugChange = True; */ bool override_logfile; +static TALLOC_CTX *tmp_debug_ctx; /* * This is to allow assignment to DEBUGLEVEL before the debug @@ -856,6 +857,8 @@ void check_log_size( void ) errno = old_errno; + TALLOC_FREE(tmp_debug_ctx); + return( 0 ); } @@ -1065,3 +1068,14 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line) SAFE_FREE(msgbuf); return ret; } + +/* + * Get us a temporary talloc context usable just for DEBUG arguments + */ +TALLOC_CTX *debug_ctx(void) +{ + if (tmp_debug_ctx == NULL) { + tmp_debug_ctx = talloc_named_const(NULL, 0, "debug_ctx"); + } + return tmp_debug_ctx; +} -- cgit