diff options
author | Chris Robinson <[email protected]> | 2010-03-20 21:49:02 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-03-20 21:49:02 -0700 |
commit | 49db3bf9166ccf5193e032acf1d810758fab267f (patch) | |
tree | dd05506256813e2dcceb2eb531707cec7ca69478 | |
parent | 99f28f25b07e28415ce58fd552dcadf2a187c3e3 (diff) |
Cleanup and fixup Release* functions
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 5 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 19 | ||||
-rw-r--r-- | OpenAL32/alDatabuffer.c | 21 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 9 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 9 |
5 files changed, 27 insertions, 36 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 5c49821a..4e04533c 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -527,10 +527,9 @@ ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) Context->EffectSlotList = temp->next; // Release effectslot structure - if(temp->EffectState) - ALEffect_Destroy(temp->EffectState); - ALTHUNK_REMOVEENTRY(temp->effectslot); + ALEffect_Destroy(temp->EffectState); + ALTHUNK_REMOVEENTRY(temp->effectslot); memset(temp, 0, sizeof(ALeffectslot)); free(temp); } diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index eaf508af..b4fc3158 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1274,21 +1274,18 @@ static void ConvertDataMULawRear(ALfloat *dst, const ALvoid *src, ALsizei len) */ ALvoid ReleaseALBuffers(ALCdevice *device) { - ALbuffer *ALBuffer; - ALbuffer *ALBufferTemp; - - ALBuffer = device->BufferList; - while(ALBuffer) + while(device->BufferList) { + ALbuffer *temp = device->BufferList; + device->BufferList = temp->next; + // Release sample data - free(ALBuffer->data); + free(temp->data); // Release Buffer structure - ALBufferTemp = ALBuffer; - ALBuffer = ALBuffer->next; - memset(ALBufferTemp, 0, sizeof(ALbuffer)); - free(ALBufferTemp); + ALTHUNK_REMOVEENTRY(temp->buffer); + memset(temp, 0, sizeof(ALbuffer)); + free(temp); } - device->BufferList = NULL; device->BufferCount = 0; } diff --git a/OpenAL32/alDatabuffer.c b/OpenAL32/alDatabuffer.c index f13bc34e..df31e6f7 100644 --- a/OpenAL32/alDatabuffer.c +++ b/OpenAL32/alDatabuffer.c @@ -650,21 +650,18 @@ ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer) */ ALvoid ReleaseALDatabuffers(ALCdevice *device) { - ALdatabuffer *ALBuffer; - ALdatabuffer *ALBufferTemp; - - ALBuffer = device->DatabufferList; - while(ALBuffer) + while(device->DatabufferList) { - // Release sample data - free(ALBuffer->data); + ALdatabuffer *temp = device->DatabufferList; + device->DatabufferList = temp->next; + + // Release buffer data + free(temp->data); // Release Buffer structure - ALBufferTemp = ALBuffer; - ALBuffer = ALBuffer->next; - memset(ALBufferTemp, 0, sizeof(ALdatabuffer)); - free(ALBufferTemp); + ALTHUNK_REMOVEENTRY(temp->databuffer); + memset(temp, 0, sizeof(ALdatabuffer)); + free(temp); } - device->DatabufferList = NULL; device->DatabufferCount = 0; } diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index a63ea72e..acf51809 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -1181,17 +1181,16 @@ ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues ALvoid ReleaseALEffects(ALCdevice *device) { - ALeffect *list = device->EffectList; - while(list) + while(device->EffectList) { - ALeffect *temp = list; - list = list->next; + ALeffect *temp = device->EffectList; + device->EffectList = temp->next; // Release effect structure + ALTHUNK_REMOVEENTRY(temp->effect); memset(temp, 0, sizeof(ALeffect)); free(temp); } - device->EffectList = NULL; device->EffectCount = 0; } diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 1e8ada32..6702ab50 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -423,17 +423,16 @@ ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues ALvoid ReleaseALFilters(ALCdevice *device) { - ALfilter *list = device->FilterList; - while(list) + while(device->FilterList) { - ALfilter *temp = list; - list = list->next; + ALfilter *temp = device->FilterList; + device->FilterList = temp->next; // Release filter structure + ALTHUNK_REMOVEENTRY(temp->filter); memset(temp, 0, sizeof(ALfilter)); free(temp); } - device->FilterList = NULL; device->FilterCount = 0; } |