aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-21 00:54:37 -0700
committerChris Robinson <[email protected]>2014-03-21 01:23:01 -0700
commitff63188cc2eb307eb874350e5281733d9c50f258 (patch)
treec422ded3a9125811f5658fb279aef96245c78268 /Alc/ALc.c
parente6e3937fa9d1d192bc26b900438b45c0e6eb5be2 (diff)
Add a generic vector interface and use it for the active effect slots
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 77175730..1b5f8109 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2173,10 +2173,7 @@ static ALCvoid FreeContext(ALCcontext *context)
context->ActiveSourceCount = 0;
context->MaxActiveSources = 0;
- context->ActiveEffectSlotCount = 0;
- free(context->ActiveEffectSlots);
- context->ActiveEffectSlots = NULL;
- context->MaxActiveEffectSlots = 0;
+ VECTOR_DEINIT(context->ActiveAuxSlots);
ALCdevice_DecRef(context->Device);
context->Device = NULL;
@@ -2891,11 +2888,13 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
ALContext->ref = 1;
ALContext->Listener = (ALlistener*)ALContext->_listener_mem;
+ VECTOR_INIT(ALContext->ActiveAuxSlots);
+
ALContext->MaxActiveSources = 256;
ALContext->ActiveSources = calloc(ALContext->MaxActiveSources,
sizeof(ALContext->ActiveSources[0]));
}
- if(!ALContext || !ALContext->ActiveSources)
+ if(!ALContext || !ALContext->ActiveAuxSlots || !ALContext->ActiveSources)
{
if(!device->ContextList)
{
@@ -2904,8 +2903,16 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
}
UnlockLists();
- free(ALContext);
- ALContext = NULL;
+ if(ALContext)
+ {
+ free(ALContext->ActiveSources);
+ ALContext->ActiveSources = NULL;
+
+ VECTOR_DEINIT(ALContext->ActiveAuxSlots);
+
+ free(ALContext);
+ ALContext = NULL;
+ }
alcSetError(device, ALC_OUT_OF_MEMORY);
ALCdevice_DecRef(device);