summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-15 21:05:11 +0100
committerVolker Lendecke <vl@samba.org>2007-12-15 22:09:35 +0100
commit6312016e2727c2b5b1a4964a98cfb9585d77cc8c (patch)
tree2d67c6ffa82ad9379281c2d15fdcfee89e6db01d
parentf00ab810d2540679bec109498ac89e1eafe18f03 (diff)
downloadsamba-6312016e2727c2b5b1a4964a98cfb9585d77cc8c.tar.gz
samba-6312016e2727c2b5b1a4964a98cfb9585d77cc8c.tar.xz
samba-6312016e2727c2b5b1a4964a98cfb9585d77cc8c.zip
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.
-rw-r--r--source/lib/debug.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/lib/debug.c b/source/lib/debug.c
index 185c2373f45..87ec9ed8f57 100644
--- a/source/lib/debug.c
+++ b/source/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;
+}