From 5e0bc7c143c4cd008c9597b68fab2fe6dfa35f0f Mon Sep 17 00:00:00 2001 From: carlo-bramini Date: Sat, 21 Oct 2017 12:41:42 +0200 Subject: [PATCH] Optimized fluid_midi_drivers[] --- src/drivers/fluid_mdriver.c | 9 ++++----- src/drivers/fluid_mdriver.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/drivers/fluid_mdriver.c b/src/drivers/fluid_mdriver.c index 54049205..a0449db2 100644 --- a/src/drivers/fluid_mdriver.c +++ b/src/drivers/fluid_mdriver.c @@ -86,7 +86,7 @@ void fluid_coremidi_driver_settings(fluid_settings_t* settings); * fluid_mdriver_definition */ struct fluid_mdriver_definition_t { - char* name; + const char* name; fluid_midi_driver_t* (*new)(fluid_settings_t* settings, handle_midi_event_func_t event_handler, void* event_handler_data); @@ -95,7 +95,7 @@ struct fluid_mdriver_definition_t { }; -struct fluid_mdriver_definition_t fluid_midi_drivers[] = { +static const struct fluid_mdriver_definition_t fluid_midi_drivers[] = { #if JACK_SUPPORT { "jack", new_fluid_jack_midi_driver, @@ -136,14 +136,13 @@ struct fluid_mdriver_definition_t fluid_midi_drivers[] = { delete_fluid_coremidi_driver, fluid_coremidi_driver_settings }, #endif - { NULL, NULL, NULL, NULL } }; void fluid_midi_driver_settings(fluid_settings_t* settings) { - int i; + unsigned int i; fluid_settings_register_int (settings, "midi.realtime-prio", FLUID_DEFAULT_MIDI_RT_PRIO, 0, 99, 0, NULL, NULL); @@ -186,7 +185,7 @@ void fluid_midi_driver_settings(fluid_settings_t* settings) fluid_settings_add_option(settings, "midi.driver", "coremidi"); #endif - for (i = 0; fluid_midi_drivers[i].name != NULL; i++) { + for (i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++) { if (fluid_midi_drivers[i].settings != NULL) { fluid_midi_drivers[i].settings(settings); } diff --git a/src/drivers/fluid_mdriver.h b/src/drivers/fluid_mdriver.h index 335dcfb6..fdb96944 100644 --- a/src/drivers/fluid_mdriver.h +++ b/src/drivers/fluid_mdriver.h @@ -21,7 +21,7 @@ #ifndef _FLUID_MDRIVER_H #define _FLUID_MDRIVER_H -#include "fluidsynth_priv.h" +#include "fluid_sys.h" void fluid_midi_driver_settings(fluid_settings_t* settings); @@ -32,7 +32,7 @@ void fluid_midi_driver_settings(fluid_settings_t* settings); struct _fluid_midi_driver_t { - char* name; + const char* name; handle_midi_event_func_t handler; void* data; };