aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-07-06 05:16:44 -0700
committerChris Robinson <[email protected]>2014-07-06 05:16:44 -0700
commit23979ac64811bd2c733b88243ff2a4797ce3ddb1 (patch)
tree8024fd17f989ace0dc09f1e095e3fa06e57c6423
parentf809d3c81aa3c9d868a207e291d19e406ad7ee61 (diff)
Use VECTOR_FIND_IF instead of a manual loop
-rw-r--r--OpenAL32/alAuxEffectSlot.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index ca1e1237..08fa5a86 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -399,21 +399,17 @@ static ALenum AddEffectSlotArray(ALCcontext *context, ALeffectslot **start, ALsi
static void RemoveEffectSlotArray(ALCcontext *context, const ALeffectslot *slot)
{
- ALeffectslot **slotlist, **slotlistend;
+ ALeffectslot **iter;
LockContext(context);
- slotlist = VECTOR_ITER_BEGIN(context->ActiveAuxSlots);
- slotlistend = VECTOR_ITER_END(context->ActiveAuxSlots);
- while(slotlist != slotlistend)
+#define MATCH_SLOT(_i) (slot == *(_i))
+ VECTOR_FIND_IF(iter, ALeffectslot*, context->ActiveAuxSlots, MATCH_SLOT);
+ if(iter != VECTOR_ITER_END(context->ActiveAuxSlots))
{
- if(*slotlist == slot)
- {
- *slotlist = VECTOR_BACK(context->ActiveAuxSlots);
- VECTOR_POP_BACK(context->ActiveAuxSlots);
- break;
- }
- slotlist++;
+ *iter = VECTOR_BACK(context->ActiveAuxSlots);
+ VECTOR_POP_BACK(context->ActiveAuxSlots);
}
+#undef MATCH_SLOT
UnlockContext(context);
}