From 73f0cb5278e714740d0de75e6b0d0bf4c815491a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 9 Aug 2012 19:40:45 +1000 Subject: 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 --- lib/ldb/common/ldb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/ldb/common/ldb.c') diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c index 779bed8d23..887a8967b1 100644 --- a/lib/ldb/common/ldb.c +++ b/lib/ldb/common/ldb.c @@ -60,7 +60,6 @@ static void ldb_tevent_debug(void *context, enum tevent_debug_level level, { struct ldb_context *ldb = talloc_get_type(context, struct ldb_context); enum ldb_debug_level ldb_level = LDB_DEBUG_FATAL; - char *s = NULL; switch (level) { case TEVENT_DEBUG_FATAL: @@ -77,10 +76,10 @@ static void ldb_tevent_debug(void *context, enum tevent_debug_level level, break; }; - vasprintf(&s, fmt, ap); - if (!s) return; - ldb_debug(ldb, ldb_level, "tevent: %s", s); - free(s); + /* There isn't a tevent: prefix here because to add it means + * actually printing the string, and most of the time we don't + * want to show it */ + ldb_vdebug(ldb, ldb_level, fmt, ap); } /* -- cgit