summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/errors.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-05-09 13:25:00 -0600
committerBrian Paul <[email protected]>2012-05-11 16:13:14 -0600
commitda35c2b38c1419690b6647fbc2f930cb04c6877f (patch)
tree6b2e2055e28a0fd4436542c1122eb5cc32ca30aa /src/mesa/main/errors.c
parent88cd47187c35fab89f5868d90a87a2d88232f871 (diff)
mesa: define DEBUG_SILENT flag, use in output_if_debug()
Diffstat (limited to 'src/mesa/main/errors.c')
-rw-r--r--src/mesa/main/errors.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 4a187b7b0f2..69dbb65cf40 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -802,21 +802,20 @@ output_if_debug(const char *prefixString, const char *outputString,
{
static int debug = -1;
- /* Check the MESA_DEBUG environment variable if it hasn't
- * been checked yet. We only have to check it once...
+ /* Init the local 'debug' var once.
+ * Note: the _mesa_init_debug() function should have been called
+ * by now so MESA_DEBUG_FLAGS will be initialized.
*/
if (debug == -1) {
- char *env = _mesa_getenv("MESA_DEBUG");
-
- /* In a debug build, we print warning messages *unless*
- * MESA_DEBUG is 0. In a non-debug build, we don't
- * print warning messages *unless* MESA_DEBUG is
- * set *to any value*.
- */
#ifdef DEBUG
- debug = (env != NULL && atoi(env) == 0) ? 0 : 1;
+ /* in debug builds, print messages unless MESA_DEBUG="silent" */
+ if (MESA_DEBUG_FLAGS & DEBUG_SILENT)
+ debug = 0;
+ else
+ debug = 1;
#else
- debug = (env != NULL) ? 1 : 0;
+ /* in release builds, be silent unless MESA_DEBUG is set */
+ debug = _mesa_getenv("MESA_DEBUG") != NULL;
#endif
}