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/reverb.c | |
parent | fc31a414732d1b45f69f66236bb52b8226762db5 (diff) |
Use inline initialization for effect state factory vtables
Diffstat (limited to 'Alc/effects/reverb.c')
-rw-r--r-- | Alc/effects/reverb.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 4a99adb7..77bf4a16 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -32,13 +32,6 @@ #include "alError.h" -typedef struct ALreverbStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALreverbStateFactory; - -static ALreverbStateFactory ReverbFactory; - - typedef struct DelayLine { // The delay lines use sample lengths that are powers of 2 to allow the @@ -1185,6 +1178,10 @@ static void ALreverbState_Delete(ALreverbState *state) DEFINE_ALEFFECTSTATE_VTABLE(ALreverbState); +typedef struct ALreverbStateFactory { + DERIVE_FROM_TYPE(ALeffectStateFactory); +} ALreverbStateFactory; + static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(factory)) { ALreverbState *state; @@ -1278,16 +1275,10 @@ static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(f DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALreverbStateFactory); - -static void init_reverb_factory(void) -{ - SET_VTABLE2(ALreverbStateFactory, ALeffectStateFactory, &ReverbFactory); -} - ALeffectStateFactory *ALreverbStateFactory_getFactory(void) { - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, init_reverb_factory); + static ALreverbStateFactory ReverbFactory = { { GET_VTABLE2(ALreverbStateFactory, ALeffectStateFactory) } }; + return STATIC_CAST(ALeffectStateFactory, &ReverbFactory); } |