[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-598-g9781967

Stefan Metzmacher metze at samba.org
Fri Feb 1 17:12:58 GMT 2008


The branch, v4-0-test has been updated
       via  9781967542b00c279563d435aec72dac1e8c7e9a (commit)
      from  fdf9bcb163516f7d96675ae0dce2917afb8f86d3 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 9781967542b00c279563d435aec72dac1e8c7e9a
Author: Amin Azez <azez at ufomechanic.net>
Date:   Fri Feb 1 16:19:36 2008 +0000

    Samba4 poor mans debug_ctx()
    
    DEBUG(), DEBUGADD() and friends can now use debug_ctx() in the
    formatting expressions again,
    e.g.
    
    DEBUG(5,("Guid failed to match: %s\n", GUID_string(debug_ctx(), r->guid)));
    
    Sadly it's done with macros (again) but when we need to save the 8 or 16
    bytes of object code per DEBUG() expression we can do it the Samba 3 way
    with added thread-safety for Samba 4. That could save up to 200K,
    allowing 12 bytes for each occurrance of DEBUG...
    
    Signed-off-by: Amin Azez <azez at ufomechanic.net>

-----------------------------------------------------------------------

Summary of changes:
 source/lib/util/debug.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/util/debug.h b/source/lib/util/debug.h
index 1895ed5..6056281 100644
--- a/source/lib/util/debug.h
+++ b/source/lib/util/debug.h
@@ -41,13 +41,17 @@ struct debug_ops {
 
 extern int DEBUGLEVEL;
 
+#define debug_ctx() (_debug_ctx?_debug_ctx:(_debug_ctx=talloc_new(NULL)))
+
 #define DEBUGLVL(level) ((level) <= DEBUGLEVEL)
 #define _DEBUG(level, body, header) do { \
 	if (DEBUGLVL(level)) { \
+		void* _debug_ctx=NULL; \
 		if (header) { \
 			do_debug_header(level, __location__, __FUNCTION__); \
 		} \
 		do_debug body; \
+		talloc_free(_debug_ctx); \
 	} \
 } while (0)
 /** 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list