diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-05-06 10:41:43 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-05-06 11:34:30 +0200 |
commit | fc336590dc35f1737ddc74333b959bdd32ee22d3 (patch) | |
tree | 651a87746b186bd311b557bf089e156fbbd5ff85 /source3/lib/ldb/common/ldb_debug.c | |
parent | 24b2dddae424215ab707029d30ec7bcd8f0e9a8e (diff) | |
download | samba-fc336590dc35f1737ddc74333b959bdd32ee22d3.tar.gz samba-fc336590dc35f1737ddc74333b959bdd32ee22d3.tar.bz2 samba-fc336590dc35f1737ddc74333b959bdd32ee22d3.zip |
Remove the copy of ldb from Samba 3.
There were two utility functions that other parts of Samba 3
still relied on; they have been moved to lib/ldb_compat.[ch].
Diffstat (limited to 'source3/lib/ldb/common/ldb_debug.c')
-rw-r--r-- | source3/lib/ldb/common/ldb_debug.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/source3/lib/ldb/common/ldb_debug.c b/source3/lib/ldb/common/ldb_debug.c deleted file mode 100644 index 3c9442ea9c..0000000000 --- a/source3/lib/ldb/common/ldb_debug.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - ldb database library - - Copyright (C) Andrew Tridgell 2004 - - ** NOTE! The following LGPL license applies to the ldb - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -/* - * Name: ldb - * - * Component: ldb debug - * - * Description: functions for printing debug messages - * - * Author: Andrew Tridgell - */ - -#include "includes.h" -#include "ldb/include/includes.h" - -/* - this allows the user to choose their own debug function -*/ -int ldb_set_debug(struct ldb_context *ldb, - void (*debug)(void *context, enum ldb_debug_level level, - const char *fmt, va_list ap), - void *context) -{ - ldb->debug_ops.debug = debug; - ldb->debug_ops.context = context; - return 0; -} - -/* - debug function for ldb_set_debug_stderr -*/ -static void ldb_debug_stderr(void *context, enum ldb_debug_level level, - const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0); -static void ldb_debug_stderr(void *context, enum ldb_debug_level level, - const char *fmt, va_list ap) -{ - if (level <= LDB_DEBUG_WARNING) { - vfprintf(stderr, fmt, ap); - } -} - -/* - convenience function to setup debug messages on stderr - messages of level LDB_DEBUG_WARNING and higher are printed -*/ -int ldb_set_debug_stderr(struct ldb_context *ldb) -{ - return ldb_set_debug(ldb, ldb_debug_stderr, ldb); -} - -/* - log a message -*/ -void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) -{ - va_list ap; - if (ldb->debug_ops.debug == NULL) { - ldb_set_debug_stderr(ldb); - } - va_start(ap, fmt); - ldb->debug_ops.debug(ldb->debug_ops.context, level, fmt, ap); - va_end(ap); -} - - -/* - log a message, and set the ldb error string to the same message -*/ -void ldb_debug_set(struct ldb_context *ldb, enum ldb_debug_level level, - const char *fmt, ...) -{ - va_list ap; - char *msg; - va_start(ap, fmt); - msg = talloc_vasprintf(ldb, fmt, ap); - va_end(ap); - if (msg != NULL) { - ldb_set_errstring(ldb, msg); - ldb_debug(ldb, level, "%s", msg); - } - talloc_free(msg); -} - |