aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alEffect.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-01-20 16:23:15 -0800
committerChris Robinson <[email protected]>2012-01-20 16:23:15 -0800
commitf520257463635f1fb93d4885673714bde146cf36 (patch)
tree993802f7d6f0de90f417df84cb1d79fadf4d83bd /OpenAL32/alEffect.c
parent00dc3088c8eee5a1ee519f16d1ce4ca367259050 (diff)
Avoid duplicating some initialization code
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r--OpenAL32/alEffect.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 3446fbd7..ff7195aa 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -55,13 +55,13 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
for(i = 0;i < n;i++)
{
ALeffect *effect = calloc(1, sizeof(ALeffect));
- if(!effect)
+ if(!effect || InitEffect(effect) != AL_NO_ERROR)
{
+ free(effect);
alSetError(Context, AL_OUT_OF_MEMORY);
alDeleteEffects(i, effects);
break;
}
- InitEffectParams(effect, AL_EFFECT_NULL);
err = NewThunkEntry(&effect->effect);
if(err == AL_NO_ERROR)
@@ -1173,6 +1173,12 @@ static void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param,
{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); }
+ALenum InitEffect(ALeffect *effect)
+{
+ InitEffectParams(effect, AL_EFFECT_NULL);
+ return AL_NO_ERROR;
+}
+
ALvoid ReleaseALEffects(ALCdevice *device)
{
ALsizei i;