diff options
author | Chris Robinson <[email protected]> | 2013-10-07 14:49:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-07 14:49:36 -0700 |
commit | b42fcce014da2c866a3d64f8f4831baed2f46e6f (patch) | |
tree | 41b9df2f2e2f7465e5147aafaa8dcf3ba67fd6f5 /Alc/effects/equalizer.c | |
parent | fc31a414732d1b45f69f66236bb52b8226762db5 (diff) |
Use inline initialization for effect state factory vtables
Diffstat (limited to 'Alc/effects/equalizer.c')
-rw-r--r-- | Alc/effects/equalizer.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index dba6cc3a..d5bd2caf 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -30,13 +30,6 @@ #include "alu.h" -typedef struct ALequalizerStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALequalizerStateFactory; - -static ALequalizerStateFactory EqualizerFactory; - - /* The document "Effects Extension Guide.pdf" says that low and high * * frequencies are cutoff frequencies. This is not fully correct, they * * are corner frequencies for low and high shelf filters. If they were * @@ -170,6 +163,10 @@ static void ALequalizerState_Delete(ALequalizerState *state) DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState); +typedef struct ALequalizerStateFactory { + DERIVE_FROM_TYPE(ALeffectStateFactory); +} ALequalizerStateFactory; + ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(factory)) { ALequalizerState *state; @@ -189,16 +186,10 @@ ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(fa DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALequalizerStateFactory); - -static void init_equalizer_factory(void) -{ - SET_VTABLE2(ALequalizerStateFactory, ALeffectStateFactory, &EqualizerFactory); -} - ALeffectStateFactory *ALequalizerStateFactory_getFactory(void) { - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, init_equalizer_factory); + static ALequalizerStateFactory EqualizerFactory = { { GET_VTABLE2(ALequalizerStateFactory, ALeffectStateFactory) } }; + return STATIC_CAST(ALeffectStateFactory, &EqualizerFactory); } |