aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/null.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-10-07 14:49:36 -0700
committerChris Robinson <[email protected]>2013-10-07 14:49:36 -0700
commitb42fcce014da2c866a3d64f8f4831baed2f46e6f (patch)
tree41b9df2f2e2f7465e5147aafaa8dcf3ba67fd6f5 /Alc/effects/null.c
parentfc31a414732d1b45f69f66236bb52b8226762db5 (diff)
Use inline initialization for effect state factory vtables
Diffstat (limited to 'Alc/effects/null.c')
-rw-r--r--Alc/effects/null.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/Alc/effects/null.c b/Alc/effects/null.c
index ff378960..816a2525 100644
--- a/Alc/effects/null.c
+++ b/Alc/effects/null.c
@@ -9,15 +9,10 @@
#include "alError.h"
-typedef struct ALnullStateFactory {
- DERIVE_FROM_TYPE(ALeffectStateFactory);
-} ALnullStateFactory;
-
typedef struct ALnullState {
DERIVE_FROM_TYPE(ALeffectState);
} ALnullState;
-static ALnullStateFactory NullFactory;
/* This destructs (not free!) the effect state. It's called only when the
* effect slot is no longer used.
@@ -63,6 +58,10 @@ static void ALnullState_Delete(ALnullState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALnullState);
+typedef struct ALnullStateFactory {
+ DERIVE_FROM_TYPE(ALeffectStateFactory);
+} ALnullStateFactory;
+
/* Creates ALeffectState objects of the appropriate type. */
ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory))
{
@@ -79,16 +78,10 @@ ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory))
/* Define the ALeffectStateFactory vtable for this type. */
DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory);
-
-static void init_none_factory(void)
-{
- SET_VTABLE2(ALnullStateFactory, ALeffectStateFactory, &NullFactory);
-}
-
ALeffectStateFactory *ALnullStateFactory_getFactory(void)
{
- static pthread_once_t once = PTHREAD_ONCE_INIT;
- pthread_once(&once, init_none_factory);
+ static ALnullStateFactory NullFactory = { { GET_VTABLE2(ALnullStateFactory, ALeffectStateFactory) } };
+
return STATIC_CAST(ALeffectStateFactory, &NullFactory);
}