mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-05 04:06:34 -05:00
error: fix the "return old snd_lib_error_set_handler() behaviour"
The variable arguments must be handled differently. Add a conversion
routine which use the original argument call convention.
Fixes: f55eece8 ("error: return old snd_lib_error_set_handler() behaviour")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
a37b8b9377
commit
8bea4b13d1
1 changed files with 22 additions and 1 deletions
23
src/error.c
23
src/error.c
|
|
@ -293,6 +293,8 @@ int snd_lib_log_filter(int prio, int interface, const char *configstr)
|
|||
return prio <= (int)level;
|
||||
}
|
||||
|
||||
static void snd_lib_error_vdefault(const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg);
|
||||
|
||||
/**
|
||||
* \brief The default log handler function.
|
||||
* \param prio Priority value (SND_LOG_*).
|
||||
|
|
@ -322,7 +324,7 @@ static void snd_lib_vlog_default(int prio, int interface, const char *file, int
|
|||
}
|
||||
if (snd_lib_error != snd_lib_error_default) {
|
||||
if (prio == SND_LOG_ERROR)
|
||||
snd_lib_error(file, line, function, errcode, fmt, arg);
|
||||
snd_lib_error_vdefault(file, line, function, errcode, fmt, arg);
|
||||
/* ignore other priorities - restore old behaviour */
|
||||
return;
|
||||
}
|
||||
|
|
@ -452,6 +454,25 @@ static void snd_lib_error_default(const char *file, int line, const char *functi
|
|||
va_end(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief The default error handler function.
|
||||
* \param file The filename where the error was hit.
|
||||
* \param line The line number.
|
||||
* \param function The function name.
|
||||
* \param errcode The error code.
|
||||
* \param fmt The message (including the format characters).
|
||||
* \param arg Optional arguments.
|
||||
* \deprecated Since 1.2.15
|
||||
*
|
||||
* Use snd_lib_vlog handler to print error message for anonymous interface.
|
||||
*/
|
||||
static void snd_lib_error_vdefault(const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg)
|
||||
{
|
||||
char msg[512];
|
||||
vsnprintf(msg, sizeof(msg), fmt, arg);
|
||||
snd_lib_error(file, line, function, errcode, "%s", msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup Error
|
||||
* \deprecated Since 1.2.15
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue