summaryrefslogtreecommitdiff
path: root/source3/lib
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
commitdb98b921449d8f3d766e5ae2696125d718054a15 (patch)
tree5d6453d20d99d3aadde9156a9b9ecf0167ed6fc0 /source3/lib
parent105635e23c5c77c5efed727bbc686650406ab82e (diff)
downloadsamba-db98b921449d8f3d766e5ae2696125d718054a15.tar.gz
samba-db98b921449d8f3d766e5ae2696125d718054a15.tar.bz2
samba-db98b921449d8f3d766e5ae2696125d718054a15.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. (This used to be commit 6312016e2727c2b5b1a4964a98cfb9585d77cc8c)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/debug.c14
1 files changed, 14 insertions, 0 deletions
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;
+}