]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Read $LIBASOUND_DEBUG as integer
authorTakashi Iwai <tiwai@suse.de>
Wed, 20 Apr 2005 14:26:49 +0000 (14:26 +0000)
committerTakashi Iwai <tiwai@suse.de>
Wed, 20 Apr 2005 14:26:49 +0000 (14:26 +0000)
Read $LIBASOUND_DEBUG as integer, 1 = hw_params dump, 2 = assert.

NOTES
src/error.c
src/pcm/pcm_params.c

diff --git a/NOTES b/NOTES
index 9a862ae5a83aff1a368d4371b57a7f14e6766906..5c0e01036206722084f081f3e855982779902cbb 100644 (file)
--- a/NOTES
+++ b/NOTES
@@ -22,9 +22,13 @@ Verbose Error Messages
 Since version 1.0.8, assert() for some non-fatal errors are removed
 and error messages are no longer shown to stderr as default.  Instead,
 the error messages appear only when the environment variable
-LIBASOUND_DEBUG is set.  When LIBASOUND_DEBUG=assert is set, the
-default error message handler calls assert() to catch with a
-debugger.
+LIBASOUND_DEBUG is set (to a non-empty value).
+
+When LIBASOUND_DEBUG=1 is set, the errors in hw_params configuration
+will be dumped to stderr.  Note that this will show even the non-fatal
+errors of plug layer (trial-and-error of parameters).
+When LIBASOUND_DEBUG=2 is set, the default error message handler calls
+assert() to catch with a debugger, in addition to parameter debugging.
 
 This feature is disabled when --with-debug=no is passed to configure,
 i.e. no strict checking is done in alsa-lib.
index 30beb3311134a84722607901dab58831a37462dc..542504c26d65621aa86bb939bfb3f28c3cb33bd7 100644 (file)
@@ -135,7 +135,7 @@ static void snd_err_msg_default(const char *file, int line, const char *function
                fprintf(stderr, ": %s", snd_strerror(err));
        putc('\n', stderr);
        va_end(arg);
-       if (! strcmp(verbose, "assert"))
+       if (! strcmp(verbose, "assert") || atoi(verbose) > 1)
                assert(0);
 }
 
index 8078ab955785580e5cf68ce42059d1ac4613af65..f868699ff16a03d136893e1e4e724c6ff670e5ae 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef NDEBUG
 /*
- * dump hw_params when $LIBASOUND_DEBUG is set
+ * dump hw_params when $LIBASOUND_DEBUG is set to >= 1
  */
 static void dump_hw_params(snd_pcm_hw_params_t *params, const char *type,
                           snd_pcm_hw_param_t var, unsigned int val, int err)
@@ -31,7 +31,7 @@ static void dump_hw_params(snd_pcm_hw_params_t *params, const char *type,
        const char *verbose = getenv("LIBASOUND_DEBUG");
        snd_output_t *out;
 
-       if (! verbose || ! *verbose)
+       if (! verbose || ! *verbose || atoi(verbose) < 1)
                return;
        if (snd_output_stdio_attach(&out, stderr, 0) < 0)
                return;