mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-05-09 23:10:59 +00:00
make fluid_log() thread safe
by using a local buffer rather than global one, intentionally breaks fluid_synth_error()
This commit is contained in:
parent
8178d72d82
commit
d25cdae17c
1 changed files with 9 additions and 9 deletions
|
@ -213,20 +213,20 @@ fluid_log_config(void)
|
||||||
int
|
int
|
||||||
fluid_log(int level, const char *fmt, ...)
|
fluid_log(int level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
fluid_log_function_t fun = NULL;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
FLUID_VSNPRINTF(fluid_errbuf, sizeof(fluid_errbuf), fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if((level >= 0) && (level < LAST_LOG_LEVEL))
|
if((level >= 0) && (level < LAST_LOG_LEVEL))
|
||||||
{
|
{
|
||||||
fun = fluid_log_function[level];
|
fluid_log_function_t fun = fluid_log_function[level];
|
||||||
|
|
||||||
if(fun != NULL)
|
if(fun != NULL)
|
||||||
{
|
{
|
||||||
(*fun)(level, fluid_errbuf, fluid_log_user_data[level]);
|
char errbuf[1024];
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
FLUID_VSNPRINTF(errbuf, sizeof(errbuf), fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
(*fun)(level, errbuf, fluid_log_user_data[level]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue