The branch, master has been updated via 86cff1d tevent: add and use debug class for tevent via b3e34d8 debug: get rid of DBGC_MAX_FIXED from 5ce5263 lib: Trim blocking.c
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 86cff1dbe23bb1e46cf9c9c3c3ec20058f09ed6e Author: Ralph Boehme <s...@samba.org> Date: Sun Jun 28 20:44:37 2015 +0200 tevent: add and use debug class for tevent Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> Autobuild-User(master): Günther Deschner <g...@samba.org> Autobuild-Date(master): Wed Jul 1 23:04:00 CEST 2015 on sn-devel-104 commit b3e34d8c1b6c08f03f9ac10414bf6d8a8e404963 Author: Ralph Boehme <s...@samba.org> Date: Wed May 13 16:03:38 2015 +0200 debug: get rid of DBGC_MAX_FIXED Simplify class table by using designated array initializers and ARRAY_SIZE macro. Signed-off-by: Ralph Boehme <s...@samba.org> Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/util/debug.c | 62 ++++++++++++++++++++++++------------------------- lib/util/debug.h | 4 +--- lib/util/tevent_debug.c | 3 +++ 3 files changed, 35 insertions(+), 34 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/debug.c b/lib/util/debug.c index dce3292..726c682 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -416,11 +416,38 @@ static void debug_backends_log(const char *msg, int msg_level) */ bool override_logfile; +static const char *default_classname_table[] = { + [DBGC_ALL] = "all", + [DBGC_TDB] = "tdb", + [DBGC_PRINTDRIVERS] = "printdrivers", + [DBGC_LANMAN] = "lanman", + [DBGC_SMB] = "smb", + [DBGC_RPC_PARSE] = "rpc_parse", + [DBGC_RPC_SRV] = "rpc_srv", + [DBGC_RPC_CLI] = "rpc_cli", + [DBGC_PASSDB] = "passdb", + [DBGC_SAM] = "sam", + [DBGC_AUTH] = "auth", + [DBGC_WINBIND] = "winbind", + [DBGC_VFS] = "vfs", + [DBGC_IDMAP] = "idmap", + [DBGC_QUOTA] = "quota", + [DBGC_ACLS] = "acls", + [DBGC_LOCKING] = "locking", + [DBGC_MSDFS] = "msdfs", + [DBGC_DMAPI] = "dmapi", + [DBGC_REGISTRY] = "registry", + [DBGC_SCAVENGER] = "scavenger", + [DBGC_DNS] = "dns", + [DBGC_LDB] = "ldb", + [DBGC_TEVENT] = "tevent", +}; + /* * This is to allow reading of DEBUGLEVEL_CLASS before the debug * system has been initialized. */ -static const int debug_class_list_initial[DBGC_MAX_FIXED + 1]; +static const int debug_class_list_initial[ARRAY_SIZE(default_classname_table)]; static int debug_num_classes = 0; int *DEBUGLEVEL_CLASS = discard_const_p(int, debug_class_list_initial); @@ -460,32 +487,6 @@ static bool log_overflow = false; * white space. There must be one name for each DBGC_<class name>, and they * must be in the table in the order of DBGC_<class name>.. */ -static const char *default_classname_table[] = { - "all", /* DBGC_ALL; index refs traditional DEBUGLEVEL */ - "tdb", /* DBGC_TDB */ - "printdrivers", /* DBGC_PRINTDRIVERS */ - "lanman", /* DBGC_LANMAN */ - "smb", /* DBGC_SMB */ - "rpc_parse", /* DBGC_RPC_PARSE */ - "rpc_srv", /* DBGC_RPC_SRV */ - "rpc_cli", /* DBGC_RPC_CLI */ - "passdb", /* DBGC_PASSDB */ - "sam", /* DBGC_SAM */ - "auth", /* DBGC_AUTH */ - "winbind", /* DBGC_WINBIND */ - "vfs", /* DBGC_VFS */ - "idmap", /* DBGC_IDMAP */ - "quota", /* DBGC_QUOTA */ - "acls", /* DBGC_ACLS */ - "locking", /* DBGC_LOCKING */ - "msdfs", /* DBGC_MSDFS */ - "dmapi", /* DBGC_DMAPI */ - "registry", /* DBGC_REGISTRY */ - "scavenger", /* DBGC_SCAVENGER */ - "dns", /* DBGC_DNS */ - "ldb", /* DBGC_LDB */ - NULL -}; static char **classname_table = NULL; @@ -744,8 +745,7 @@ Init debugging (one time stuff) static void debug_init(void) { - int i; - const char **p; + size_t i; if (state.initialized) return; @@ -754,8 +754,8 @@ static void debug_init(void) debug_setup_talloc_log(); - for(p = default_classname_table; *p; p++) { - debug_add_class(*p); + for (i = 0; i < ARRAY_SIZE(default_classname_table); i++) { + debug_add_class(default_classname_table[i]); } for (i = 0; i < ARRAY_SIZE(debug_backends); i++) { diff --git a/lib/util/debug.h b/lib/util/debug.h index 8d8f43d..c312bbf 100644 --- a/lib/util/debug.h +++ b/lib/util/debug.h @@ -88,9 +88,7 @@ bool dbghdr( int level, const char *location, const char *func); #define DBGC_SCAVENGER 20 #define DBGC_DNS 21 #define DBGC_LDB 22 - -/* Always ensure this is updated when new fixed classes area added, to ensure the array in debug.c is the right size */ -#define DBGC_MAX_FIXED 22 +#define DBGC_TEVENT 23 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS diff --git a/lib/util/tevent_debug.c b/lib/util/tevent_debug.c index bfbaed6..48f6529 100644 --- a/lib/util/tevent_debug.c +++ b/lib/util/tevent_debug.c @@ -19,6 +19,9 @@ #include "includes.h" #include <tevent.h> +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_TEVENT + static void samba_tevent_debug(void *context, enum tevent_debug_level level, const char *fmt, -- Samba Shared Repository