From 35fda6c5f344e71b1ed0bd195a62161e31401149 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 10 Jul 2006 12:51:36 +0000 Subject: r16916: Implement metze's proposed changes to the tdb logging API. This clearly links the log function with its private pointer, and makes the argument list for tdb_open_ex a bit shorter. Andrew Bartlett (This used to be commit 5d5503e8d8a10ead3ef21a5ffda52cadb9a07727) --- source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/ldb_tdb') diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c index 31276d3948..df9cac1307 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c @@ -63,7 +63,7 @@ static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, con { va_list ap; const char *name = tdb_name(tdb); - struct ldb_context *ldb = talloc_get_type(tdb_logging_private(tdb), struct ldb_context); + struct ldb_context *ldb = talloc_get_type(tdb_get_logging_private(tdb), struct ldb_context); enum ldb_debug_level ldb_level; char *message; va_start(ap, fmt); @@ -106,6 +106,9 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx, { struct ltdb_wrap *w; struct stat st; + struct tdb_logging_context log_ctx; + log_ctx.log_fn = ltdb_log_fn; + log_ctx.log_private = ldb; if (stat(path, &st) == 0) { for (w=tdb_list;w;w=w->next) { @@ -121,7 +124,7 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx, return NULL; } - w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, ltdb_log_fn, ldb, NULL); + w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, &log_ctx, NULL); if (w->tdb == NULL) { talloc_free(w); return NULL; -- cgit