From 23979ac64811bd2c733b88243ff2a4797ce3ddb1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 6 Jul 2014 05:16:44 -0700 Subject: Use VECTOR_FIND_IF instead of a manual loop --- OpenAL32/alAuxEffectSlot.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'OpenAL32') 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); } -- cgit v1.2.3