diff options
author | Chris Robinson <[email protected]> | 2013-03-24 13:55:41 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-03-24 13:55:41 -0700 |
commit | 43b406ad9bb32ebde78d26255a2a4f4a09a29926 (patch) | |
tree | 6df448e540966a83070fd1155b9f64a0a00340f5 /OpenAL32/alSource.c | |
parent | dd48375bd6569d8695291d68152fe45016bf37b1 (diff) |
Simplify al_try code
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 5dbea314..f98b31ea 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1230,7 +1230,10 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) { ALsource *source = al_calloc(16, sizeof(ALsource)); if(!source) + { + alDeleteSources(cur, sources); al_throwerr(Context, AL_OUT_OF_MEMORY); + } InitSourceParams(source); err = NewThunkEntry(&source->id); @@ -1242,17 +1245,13 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) memset(source, 0, sizeof(ALsource)); al_free(source); + alDeleteSources(cur, sources); al_throwerr(Context, err); } sources[cur] = source->id; } } - al_catchany() - { - if(cur > 0) - alDeleteSources(cur, sources); - } al_endtry; ALCcontext_DecRef(Context); @@ -2169,24 +2168,23 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const BufferListStart->prev = BufferList; BufferList->next = BufferListStart; } + BufferListStart = NULL; Source->BuffersInQueue += nb; UnlockContext(Context); } - al_catchany() + al_endtry; + + while(BufferListStart) { - while(BufferListStart) - { - BufferList = BufferListStart; - BufferListStart = BufferList->next; + BufferList = BufferListStart; + BufferListStart = BufferList->next; - if(BufferList->buffer) - DecrementRef(&BufferList->buffer->ref); - free(BufferList); - } + if(BufferList->buffer) + DecrementRef(&BufferList->buffer->ref); + free(BufferList); } - al_endtry; ALCcontext_DecRef(Context); } |