aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-27 13:16:17 -0700
committerChris Robinson <[email protected]>2013-05-27 13:16:17 -0700
commit334a7c1d59961277263a7a69575325aeef0987ee (patch)
treef96e8536a0e1a1e5e099ee00ffc76f51f0d4532d
parent8d874512b6a1520dc9fbbe6322495e9e2da9dc3c (diff)
Cleanup the ALeffectStateFactory_create methods
Get rid of the ALeffectStateFactory_create macro, and use the VCALL_NOARGS helper (requires adding the 'this' factory parameter).
-rw-r--r--Alc/effects/chorus.c3
-rw-r--r--Alc/effects/dedicated.c3
-rw-r--r--Alc/effects/distortion.c3
-rw-r--r--Alc/effects/echo.c3
-rw-r--r--Alc/effects/equalizer.c3
-rw-r--r--Alc/effects/flanger.c3
-rw-r--r--Alc/effects/modulator.c3
-rw-r--r--Alc/effects/null.c3
-rw-r--r--Alc/effects/reverb.c3
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h8
-rw-r--r--OpenAL32/alAuxEffectSlot.c4
11 files changed, 23 insertions, 16 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index 6a1a2d9c..34caf62d 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -251,9 +251,10 @@ static void ALchorusState_Delete(ALchorusState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALchorusState);
-static ALeffectState *ALchorusStateFactory_create(void)
+static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *factory)
{
ALchorusState *state;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c
index 9ed68af2..4d3485fb 100644
--- a/Alc/effects/dedicated.c
+++ b/Alc/effects/dedicated.c
@@ -93,10 +93,11 @@ static void ALdedicatedState_Delete(ALdedicatedState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState);
-ALeffectState *ALdedicatedStateFactory_create(void)
+ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *factory)
{
ALdedicatedState *state;
ALsizei s;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c
index 950ce109..84440cce 100644
--- a/Alc/effects/distortion.c
+++ b/Alc/effects/distortion.c
@@ -242,9 +242,10 @@ static void ALdistortionState_Delete(ALdistortionState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALdistortionState);
-static ALeffectState *ALdistortionStateFactory_create(void)
+static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory *factory)
{
ALdistortionState *state;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index 8e4205fc..b2b50836 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -183,9 +183,10 @@ static void ALechoState_Delete(ALechoState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALechoState);
-ALeffectState *ALechoStateFactory_create(void)
+ALeffectState *ALechoStateFactory_create(ALechoStateFactory *factory)
{
ALechoState *state;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index 1264e93c..3a77c63f 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -284,10 +284,11 @@ static void ALequalizerState_Delete(ALequalizerState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState);
-ALeffectState *ALequalizerStateFactory_create(void)
+ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *factory)
{
ALequalizerState *state;
int it;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c
index db8240ce..28499cd1 100644
--- a/Alc/effects/flanger.c
+++ b/Alc/effects/flanger.c
@@ -251,9 +251,10 @@ static void ALflangerState_Delete(ALflangerState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALflangerState);
-ALeffectState *ALflangerStateFactory_create(void)
+ALeffectState *ALflangerStateFactory_create(ALflangerStateFactory *factory)
{
ALflangerState *state;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c
index a7b84d30..0a8a4512 100644
--- a/Alc/effects/modulator.c
+++ b/Alc/effects/modulator.c
@@ -205,9 +205,10 @@ static void ALmodulatorState_Delete(ALmodulatorState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALmodulatorState);
-static ALeffectState *ALmodulatorStateFactory_create(void)
+static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *factory)
{
ALmodulatorState *state;
+ (void)factory;
state = malloc(sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/null.c b/Alc/effects/null.c
index aed19a82..f7262ca5 100644
--- a/Alc/effects/null.c
+++ b/Alc/effects/null.c
@@ -71,9 +71,10 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALnullState);
/* Creates ALeffectState objects of the appropriate type. */
-ALeffectState *ALnullStateFactory_create(void)
+ALeffectState *ALnullStateFactory_create(ALnullStateFactory *factory)
{
ALnullState *state;
+ (void)factory;
state = calloc(1, sizeof(*state));
if(!state) return NULL;
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 380361e5..7dcabe3a 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -1182,10 +1182,11 @@ static void ALreverbState_Delete(ALreverbState *state)
DEFINE_ALEFFECTSTATE_VTABLE(ALreverbState);
-static ALeffectState *ALreverbStateFactory_create(void)
+static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory *factory)
{
ALreverbState *state;
ALuint index;
+ (void)factory;
state = malloc(sizeof(ALreverbState));
if(!state) return NULL;
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index d496df8d..60724654 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -48,18 +48,16 @@ static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \
struct ALeffectStateFactoryVtable {
- ALeffectState *(*const create)(void);
+ ALeffectState *(*const create)(ALeffectStateFactory *factory);
};
struct ALeffectStateFactory {
const struct ALeffectStateFactoryVtable *vtbl;
};
-#define ALeffectStateFactory_create(p) ((p)->vtbl->create())
-
#define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \
-static ALeffectState* T##_ALeffectStateFactory_create(void) \
-{ return T##_create(); } \
+static ALeffectState* T##_ALeffectStateFactory_create(ALeffectStateFactory *factory) \
+{ return T##_create(STATIC_UPCAST(T, ALeffectStateFactory, factory)); } \
\
static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \
T##_ALeffectStateFactory_create, \
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 14dd8816..878597d9 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -486,7 +486,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e
ERR("Failed to find factory for effect type 0x%04x\n", newtype);
return AL_INVALID_ENUM;
}
- State = ALeffectStateFactory_create(factory);
+ State = VCALL_NOARGS(factory,create);
if(!State)
return AL_OUT_OF_MEMORY;
@@ -548,7 +548,7 @@ ALenum InitEffectSlot(ALeffectslot *slot)
slot->EffectType = AL_EFFECT_NULL;
factory = getFactoryByType(AL_EFFECT_NULL);
- if(!(slot->EffectState=ALeffectStateFactory_create(factory)))
+ if(!(slot->EffectState=VCALL_NOARGS(factory,create)))
return AL_OUT_OF_MEMORY;
slot->Gain = 1.0;