From f511538d06e6bbeca263cf3465f0b9bdcf9040bb Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 6 Nov 2013 04:58:01 -0800 Subject: [PATCH] replace obsolete _init and _fini --- crap_eq.c | 16 +++------------- crap_eq_const.c | 3 --- crap_util.h | 5 ++--- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/crap_eq.c b/crap_eq.c index c4ffcd6..4198c67 100644 --- a/crap_eq.c +++ b/crap_eq.c @@ -26,8 +26,7 @@ typedef unsigned long ulong; #define BW_MIN 0.02 #define BW_MAX 8 -static int ready = 0; -void _init(); +void __attribute__ ((constructor)) eq_init(); LADSPA_PortDescriptor p_discs[PCOUNT]; LADSPA_PortRangeHint p_hints[PCOUNT]; @@ -62,10 +61,8 @@ typedef struct { LADSPA_Data run_adding_gain; } eq_t; -DLL_EXPORT const LADSPA_Descriptor * +const LADSPA_Descriptor * ladspa_descriptor(ulong index) { - if (!ready) _init(); - if (index != 0) return NULL; return &eqDescriptor; @@ -180,7 +177,7 @@ set_run_adding_gain(LADSPA_Handle instance, LADSPA_Data gain) { } void -_init() { +eq_init() { #define INCTRL (LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL) #define BOUNDED (LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE) for (int i = 0; i < BANDS; i++) { @@ -229,11 +226,4 @@ _init() { eqDescriptor.run = run_eq; eqDescriptor.run_adding = run_adding_eq; eqDescriptor.set_run_adding_gain = set_run_adding_gain; - - ready = 1; } - -void -_fini() { -} - diff --git a/crap_eq_const.c b/crap_eq_const.c index 1c33279..e004b7d 100755 --- a/crap_eq_const.c +++ b/crap_eq_const.c @@ -107,9 +107,6 @@ set_run_adding_gain(LADSPA_Handle instance, LADSPA_Data gain) { eq->run_adding_gain = gain; } -void _init() {} -void _fini() {} - static const LADSPA_Descriptor eqDescriptor = { .UniqueID = 0xDEFACED, .Label = "crap_eq_const", diff --git a/crap_util.h b/crap_util.h index 42617eb..1b58ada 100644 --- a/crap_util.h +++ b/crap_util.h @@ -1,7 +1,6 @@ #ifdef WIN32 -#define DLL_EXPORT __declspec(dllexport) -#else -#define DLL_EXPORT +__declspec(dllexport) const LADSPA_Descriptor * +ladspa_descriptor(unsigned long Index); #endif #ifndef M_PI