From 2b563071f6f671e8d808a5d352ebb95408ca25b6 Mon Sep 17 00:00:00 2001 From: derselbst Date: Tue, 9 Oct 2018 18:11:37 +0200 Subject: [PATCH] initialize logging at compile time --- src/synth/fluid_synth.c | 2 -- src/utils/fluid_sys.c | 62 ++++++----------------------------------- src/utils/fluid_sys.h | 6 ---- 3 files changed, 9 insertions(+), 61 deletions(-) diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index c7ce3dde1..a40ba2eaa 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -290,8 +290,6 @@ fluid_synth_init(void) fluid_rvoice_dsp_config(); - fluid_sys_config(); - init_dither(); /* custom_breath2att_mod is not a default modulator specified in SF2.01. diff --git a/src/utils/fluid_sys.c b/src/utils/fluid_sys.c index 16e13cd5a..75da8c2a1 100644 --- a/src/utils/fluid_sys.c +++ b/src/utils/fluid_sys.c @@ -76,18 +76,17 @@ static int fluid_istream_gets(fluid_istream_t in, char *buf, int len); static char fluid_errbuf[512]; /* buffer for error message */ -static fluid_log_function_t fluid_log_function[LAST_LOG_LEVEL]; -static void *fluid_log_user_data[LAST_LOG_LEVEL]; -static int fluid_log_initialized = 0; - -static const char fluid_libname[] = "fluidsynth"; - - -void fluid_sys_config() +static fluid_log_function_t fluid_log_function[LAST_LOG_LEVEL] = { - fluid_log_config(); -} + fluid_default_log_function, + fluid_default_log_function, + fluid_default_log_function, + fluid_default_log_function, + fluid_default_log_function +}; +static void *fluid_log_user_data[LAST_LOG_LEVEL] = { NULL }; +static const char fluid_libname[] = "fluidsynth"; /** * Installs a new log function for a specified log level. @@ -128,11 +127,6 @@ fluid_default_log_function(int level, const char *message, void *data) out = stderr; #endif - if(fluid_log_initialized == 0) - { - fluid_log_config(); - } - switch(level) { case FLUID_PANIC: @@ -165,44 +159,6 @@ fluid_default_log_function(int level, const char *message, void *data) fflush(out); } -/* - * fluid_init_log - */ -void -fluid_log_config(void) -{ - if(fluid_log_initialized == 0) - { - - fluid_log_initialized = 1; - - if(fluid_log_function[FLUID_PANIC] == NULL) - { - fluid_set_log_function(FLUID_PANIC, fluid_default_log_function, NULL); - } - - if(fluid_log_function[FLUID_ERR] == NULL) - { - fluid_set_log_function(FLUID_ERR, fluid_default_log_function, NULL); - } - - if(fluid_log_function[FLUID_WARN] == NULL) - { - fluid_set_log_function(FLUID_WARN, fluid_default_log_function, NULL); - } - - if(fluid_log_function[FLUID_INFO] == NULL) - { - fluid_set_log_function(FLUID_INFO, fluid_default_log_function, NULL); - } - - if(fluid_log_function[FLUID_DBG] == NULL) - { - fluid_set_log_function(FLUID_DBG, fluid_default_log_function, NULL); - } - } -} - /** * Print a message to the log. * @param level Log level (#fluid_log_level). diff --git a/src/utils/fluid_sys.h b/src/utils/fluid_sys.h index a56a24100..47cc95c11 100644 --- a/src/utils/fluid_sys.h +++ b/src/utils/fluid_sys.h @@ -52,12 +52,6 @@ */ #define fluid_gerror_message(err) ((err) ? err->message : "No error details") - -void fluid_sys_config(void); -void fluid_log_config(void); -void fluid_time_config(void); - - /* Misc */ #if defined(__INTEL_COMPILER) #define FLUID_RESTRICT restrict