diff options
author | Jakob Bornecrantz <[email protected]> | 2010-04-22 18:20:06 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2010-04-23 21:57:49 +0100 |
commit | 7159303dbf5ae4023e41dd188f3391807f5b892b (patch) | |
tree | 0b48e70c74622d22e44b5a9bd81d1afa579da7ca /src/gallium/auxiliary/util/u_debug.c | |
parent | 2ce1d6696b1415fcc340bcf888904e43c2792c68 (diff) |
gallium: Add option to not print options
Diffstat (limited to 'src/gallium/auxiliary/util/u_debug.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index dd044973f96..0de38e791d6 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -74,6 +74,24 @@ void debug_print_blob( const char *name, #endif +static boolean +debug_get_option_should_print(void) +{ + static boolean first = TRUE; + static boolean value = FALSE; + + if (!first) + return value; + + /* Oh hey this will call into this function, + * but its cool since we set first to false + */ + first = FALSE; + value = debug_get_bool_option("GALLIUM_PRINT_OPTIONS", TRUE); + /* XXX should we print this option? Currently it wont */ + return value; +} + const char * debug_get_option(const char *name, const char *dfault) { @@ -82,8 +100,9 @@ debug_get_option(const char *name, const char *dfault) result = os_get_option(name); if(!result) result = dfault; - - debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)"); + + if (debug_get_option_should_print()) + debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)"); return result; } @@ -109,7 +128,8 @@ debug_get_bool_option(const char *name, boolean dfault) else result = TRUE; - debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE"); + if (debug_get_option_should_print()) + debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE"); return result; } @@ -142,8 +162,9 @@ debug_get_num_option(const char *name, long dfault) } result *= sign; } - - debug_printf("%s: %s = %li\n", __FUNCTION__, name, result); + + if (debug_get_option_should_print()) + debug_printf("%s: %s = %li\n", __FUNCTION__, name, result); return result; } @@ -176,11 +197,12 @@ debug_get_flags_option(const char *name, } } - if (str) { - debug_printf("%s: %s = 0x%lx (%s)\n", __FUNCTION__, name, result, str); - } - else { - debug_printf("%s: %s = 0x%lx\n", __FUNCTION__, name, result); + if (debug_get_option_should_print()) { + if (str) { + debug_printf("%s: %s = 0x%lx (%s)\n", __FUNCTION__, name, result, str); + } else { + debug_printf("%s: %s = 0x%lx\n", __FUNCTION__, name, result); + } } return result; |