summaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-30 17:32:49 -0700
committerChris Robinson <[email protected]>2011-08-30 17:32:49 -0700
commit7d577832cd6570480f31fc390ad079bbeeadc692 (patch)
tree9be532f347804bb73a46cc9226edfeab4a748695 /OpenAL32/alSource.c
parentc4866afbe0d4a2b32ca6c409a0ce87f70ac1f693 (diff)
Add functions to retrieve the source from the source map while removing it
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index a0988e5d..e45cbcd9 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -51,6 +51,7 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum eName, ALdouble *Offsets,
static ALint GetByteOffset(ALsource *Source);
#define LookupSource(m, k) ((ALsource*)LookupUIntMapKey(&(m), (k)))
+#define RemoveSource(m, k) ((ALsource*)PopUIntMapValue(&(m), (k)))
#define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k)))
#define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k)))
#define LookupEffectSlot(m, k) ((ALeffectslot*)LookupUIntMapKey(&(m), (k)))
@@ -143,17 +144,13 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
{
ALsource **srclist, **srclistend;
- LockContext(Context);
- if((Source=LookupSource(Context->SourceMap, sources[i])) == NULL)
- {
- UnlockContext(Context);
+ // Remove Source from list of Sources
+ if((Source=RemoveSource(Context->SourceMap, sources[i])) == NULL)
continue;
- }
- // Remove Source from list of Sources
- RemoveUIntMapKey(&Context->SourceMap, Source->source);
FreeThunkEntry(Source->source);
+ LockContext(Context);
srclist = Context->ActiveSources;
srclistend = srclist + Context->ActiveSourceCount;
while(srclist != srclistend)