diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2006-09-11 15:05:21 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2006-09-11 15:05:21 +0000 |
commit | 05d90f4f20c1fbbb6c532b5f62531c97ced7d63e (patch) | |
tree | 6cca68f46fc8a6f758ae66a45a9656fbfda94418 /dbus/dbus-internals.c | |
parent | eed8a8a7bd11f1d070b441675f4c498dd07a78c2 (diff) | |
download | dbus-05d90f4f20c1fbbb6c532b5f62531c97ced7d63e.tar.gz |
* dbus/dbus-internal.c: Add dbus_is_verbose so we can have more
complex debugging code
* dbus/dbus-marshal-basic.c (_dbus_marshal_read_fixed_multi): Move
between the test suite ifdefs
(_dbus_verbose_bytes): return if verbosity is not enabled
Diffstat (limited to 'dbus/dbus-internals.c')
-rw-r--r-- | dbus/dbus-internals.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index e2d01b11..75eb8ced 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -213,12 +213,31 @@ _dbus_warn (const char *format, #ifdef DBUS_ENABLE_VERBOSE_MODE static dbus_bool_t verbose_initted = FALSE; +static dbus_bool_t verbose = TRUE; #define PTHREAD_IN_VERBOSE 0 #if PTHREAD_IN_VERBOSE #include <pthread.h> #endif +static inline void +_dbus_verbose_init (void) +{ + if (!verbose_initted) + { + const char *p = _dbus_getenv ("DBUS_VERBOSE"); + verbose = p != NULL && *p == '1'; + verbose_initted = TRUE; + } +} + +dbus_bool_t +_dbus_is_verbose_real (void) +{ + _dbus_verbose_init (); + return verbose; +} + /** * Prints a warning message to stderr * if the user has enabled verbose mode. @@ -232,7 +251,6 @@ _dbus_verbose_real (const char *format, ...) { va_list args; - static dbus_bool_t verbose = TRUE; static dbus_bool_t need_pid = TRUE; int len; @@ -240,17 +258,8 @@ _dbus_verbose_real (const char *format, * in the non-verbose case we just have the one * conditional and return immediately. */ - if (!verbose) + if (!_dbus_is_verbose_real()) return; - - if (!verbose_initted) - { - const char *p = _dbus_getenv ("DBUS_VERBOSE"); - verbose = p != NULL && *p == '1'; - verbose_initted = TRUE; - if (!verbose) - return; - } /* Print out pid before the line */ if (need_pid) |