diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 19:40:45 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 20:14:23 +1000 |
commit | 73f0cb5278e714740d0de75e6b0d0bf4c815491a (patch) | |
tree | fa5df779ed79dbf17ff30d647963e9c98d990f0b /lib/ldb/common/ldb_debug.c | |
parent | 7e562cf3eb8d8aabf9b5d62a92e67221e4f07e3a (diff) | |
download | samba-73f0cb5278e714740d0de75e6b0d0bf4c815491a.tar.gz samba-73f0cb5278e714740d0de75e6b0d0bf4c815491a.tar.bz2 samba-73f0cb5278e714740d0de75e6b0d0bf4c815491a.zip |
lib/ldb: Do not vasprintf() the tevent debug messages that will not be shown
This malloc() and free() actually shows up quite high on a call profile of
provision of the AD DC.
This allows the debug handler to decide if the argument list should be
printed.
Andrew Bartlett
Diffstat (limited to 'lib/ldb/common/ldb_debug.c')
-rw-r--r-- | lib/ldb/common/ldb_debug.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/ldb/common/ldb_debug.c b/lib/ldb/common/ldb_debug.c index 6aa58ccf71..d5e9e7aa29 100644 --- a/lib/ldb/common/ldb_debug.c +++ b/lib/ldb/common/ldb_debug.c @@ -79,11 +79,10 @@ int ldb_set_debug_stderr(struct ldb_context *ldb) } /* - log a message + log a message (va_list helper for ldb_tevent_debug) */ -void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) +void ldb_vdebug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, va_list ap) { - va_list ap; if (ldb->debug_ops.debug == NULL) { if (ldb->flags & LDB_FLG_ENABLE_TRACING) { ldb_set_debug(ldb, ldb_debug_stderr_all, ldb); @@ -91,8 +90,17 @@ void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char * ldb_set_debug_stderr(ldb); } } - va_start(ap, fmt); ldb->debug_ops.debug(ldb->debug_ops.context, level, fmt, ap); +} + +/* + log a message +*/ +void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + ldb_vdebug(ldb, level, fmt, ap); va_end(ap); } |