aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/effects/autowah.c7
-rw-r--r--Alc/effects/chorus.c7
-rw-r--r--Alc/effects/compressor.c7
-rw-r--r--Alc/effects/dedicated.c7
-rw-r--r--Alc/effects/distortion.c7
-rw-r--r--Alc/effects/echo.c7
-rw-r--r--Alc/effects/equalizer.c7
-rw-r--r--Alc/effects/flanger.c7
-rw-r--r--Alc/effects/modulator.c7
-rw-r--r--Alc/effects/null.c18
-rw-r--r--Alc/effects/reverb.c7
11 files changed, 34 insertions, 54 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c
index 527e3be6..9857c722 100644
--- a/Alc/effects/autowah.c
+++ b/Alc/effects/autowah.c
@@ -151,10 +151,7 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo,
}
}
-static void ALautowahState_Delete(ALautowahState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALautowahState)
DEFINE_ALEFFECTSTATE_VTABLE(ALautowahState);
@@ -167,7 +164,7 @@ static ALeffectState *ALautowahStateFactory_create(ALautowahStateFactory *UNUSED
{
ALautowahState *state;
- state = malloc(sizeof(*state));
+ state = ALautowahState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALautowahState, ALeffectState, state);
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index 4945faf2..f2e43eb6 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -224,10 +224,7 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, co
}
}
-static void ALchorusState_Delete(ALchorusState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALchorusState)
DEFINE_ALEFFECTSTATE_VTABLE(ALchorusState);
@@ -240,7 +237,7 @@ static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(f
{
ALchorusState *state;
- state = malloc(sizeof(*state));
+ state = ALchorusState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALchorusState, ALeffectState, state);
diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c
index bab155c8..9728cabe 100644
--- a/Alc/effects/compressor.c
+++ b/Alc/effects/compressor.c
@@ -133,10 +133,7 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples
}
}
-static void ALcompressorState_Delete(ALcompressorState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALcompressorState)
DEFINE_ALEFFECTSTATE_VTABLE(ALcompressorState);
@@ -149,7 +146,7 @@ static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory *
{
ALcompressorState *state;
- state = malloc(sizeof(*state));
+ state = ALcompressorState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALcompressorState, ALeffectState, state);
diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c
index fe57c7d8..89af1c84 100644
--- a/Alc/effects/dedicated.c
+++ b/Alc/effects/dedicated.c
@@ -76,10 +76,7 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesTo
}
}
-static void ALdedicatedState_Delete(ALdedicatedState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALdedicatedState)
DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState);
@@ -93,7 +90,7 @@ ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(fa
ALdedicatedState *state;
ALsizei s;
- state = malloc(sizeof(*state));
+ state = ALdedicatedState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALdedicatedState, ALeffectState, state);
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c
index e39a8197..b535655b 100644
--- a/Alc/effects/distortion.c
+++ b/Alc/effects/distortion.c
@@ -170,10 +170,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples
}
}
-static void ALdistortionState_Delete(ALdistortionState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALdistortionState)
DEFINE_ALEFFECTSTATE_VTABLE(ALdistortionState);
@@ -186,7 +183,7 @@ static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory *
{
ALdistortionState *state;
- state = malloc(sizeof(*state));
+ state = ALdistortionState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALdistortionState, ALeffectState, state);
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index 7471c3dd..9513a611 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -161,10 +161,7 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const
state->Offset = offset;
}
-static void ALechoState_Delete(ALechoState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALechoState)
DEFINE_ALEFFECTSTATE_VTABLE(ALechoState);
@@ -177,7 +174,7 @@ ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory))
{
ALechoState *state;
- state = malloc(sizeof(*state));
+ state = ALechoState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALechoState, ALeffectState, state);
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index d5bd2caf..cfe7c46c 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -155,10 +155,7 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo
}
}
-static void ALequalizerState_Delete(ALequalizerState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALequalizerState)
DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState);
@@ -172,7 +169,7 @@ ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(fa
ALequalizerState *state;
int it;
- state = malloc(sizeof(*state));
+ state = ALequalizerState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALequalizerState, ALeffectState, state);
diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c
index a94cd365..b8560206 100644
--- a/Alc/effects/flanger.c
+++ b/Alc/effects/flanger.c
@@ -224,10 +224,7 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo,
}
}
-static void ALflangerState_Delete(ALflangerState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALflangerState)
DEFINE_ALEFFECTSTATE_VTABLE(ALflangerState);
@@ -240,7 +237,7 @@ ALeffectState *ALflangerStateFactory_create(ALflangerStateFactory *UNUSED(factor
{
ALflangerState *state;
- state = malloc(sizeof(*state));
+ state = ALflangerState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALflangerState, ALeffectState, state);
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c
index 17ca7e17..a5475708 100644
--- a/Alc/effects/modulator.c
+++ b/Alc/effects/modulator.c
@@ -171,10 +171,7 @@ static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesTo
}
}
-static void ALmodulatorState_Delete(ALmodulatorState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALmodulatorState)
DEFINE_ALEFFECTSTATE_VTABLE(ALmodulatorState);
@@ -187,7 +184,7 @@ static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UN
{
ALmodulatorState *state;
- state = malloc(sizeof(*state));
+ state = ALmodulatorState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALmodulatorState, ALeffectState, state);
diff --git a/Alc/effects/null.c b/Alc/effects/null.c
index 816a2525..6dacd021 100644
--- a/Alc/effects/null.c
+++ b/Alc/effects/null.c
@@ -48,10 +48,20 @@ static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samp
(void)samplesOut;
}
-/* This frees the memory used by the object, after it has been destructed. */
-static void ALnullState_Delete(ALnullState *state)
+/* This allocates memory to store the object, before it gets constructed.
+ * DECLARE_DEFAULT_ALLOCATORS can be used to declate a default method.
+ */
+static void *ALnullState_New(size_t size)
+{
+ return malloc(size);
+}
+
+/* This frees the memory used by the object, after it has been destructed.
+ * DECLARE_DEFAULT_ALLOCATORS can be used to declate a default method.
+ */
+static void ALnullState_Delete(void *ptr)
{
- free(state);
+ free(ptr);
}
/* Define the forwards and the ALeffectState vtable for this type. */
@@ -67,7 +77,7 @@ ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory))
{
ALnullState *state;
- state = calloc(1, sizeof(*state));
+ state = ALnullState_New(sizeof(*state));
if(!state) return NULL;
/* Set vtables for inherited types. */
SET_VTABLE2(ALnullState, ALeffectState, state);
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 75ec76e3..d5a28823 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -1170,10 +1170,7 @@ static ALvoid ALreverbState_Destruct(ALreverbState *State)
State->SampleBuffer = NULL;
}
-static void ALreverbState_Delete(ALreverbState *state)
-{
- free(state);
-}
+DECLARE_DEFAULT_ALLOCATORS(ALreverbState)
DEFINE_ALEFFECTSTATE_VTABLE(ALreverbState);
@@ -1187,7 +1184,7 @@ static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(f
ALreverbState *state;
ALuint index;
- state = malloc(sizeof(ALreverbState));
+ state = ALreverbState_New(sizeof(*state));
if(!state) return NULL;
SET_VTABLE2(ALreverbState, ALeffectState, state);