aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-12 02:17:31 -0700
committerChris Robinson <[email protected]>2011-09-12 02:17:31 -0700
commit780417ba398430a0c2b998b38f27be28029cefc8 (patch)
treeeaf659e195db0f834f1816ee9419b68f7f23e77a /Alc/ALc.c
parent9f159bfb339b626267fd28cae8fde3328341c99e (diff)
Use VerifyDevice to validate a device handle instead of IsDevice
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index f5fa09e1..dea9565f 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1024,22 +1024,6 @@ static ALCboolean IsValidALCChannels(ALCenum channels)
return ALC_FALSE;
}
-/* IsDevice
- *
- * Check if the device pointer is valid (caller is responsible for holding the
- * list lock).
- */
-static ALCboolean IsDevice(ALCdevice *pDevice)
-{
- ALCdevice *pTempDevice;
-
- pTempDevice = g_pDeviceList;
- while(pTempDevice && pTempDevice != pDevice)
- pTempDevice = pTempDevice->next;
-
- return (pTempDevice ? ALC_TRUE : ALC_FALSE);
-}
-
/* IsContext
*
* Check if the context pointer is valid (caller is responsible for holding the
@@ -2682,10 +2666,7 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device
{
ALCboolean ret = ALC_FALSE;
- LockLists();
- if(!IsDevice(device))
- alcSetError(NULL, ALC_INVALID_DEVICE);
- else if(!device->IsLoopbackDevice)
+ if(!(device=VerifyDevice(device)) || !device->IsLoopbackDevice)
alcSetError(device, ALC_INVALID_DEVICE);
else if(freq <= 0)
alcSetError(device, ALC_INVALID_VALUE);
@@ -2697,7 +2678,7 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device
freq >= 8000)
ret = ALC_TRUE;
}
- UnlockLists();
+ if(device) ALCdevice_DecRef(device);
return ret;
}
@@ -2709,16 +2690,13 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device
*/
ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
{
- LockLists();
- if(!IsDevice(device))
- alcSetError(NULL, ALC_INVALID_DEVICE);
- else if(!device->IsLoopbackDevice)
+ if(!(device=VerifyDevice(device)) || !device->IsLoopbackDevice)
alcSetError(device, ALC_INVALID_DEVICE);
else if(samples < 0 || (samples > 0 && buffer == NULL))
alcSetError(device, ALC_INVALID_VALUE);
else
aluMixData(device, buffer, samples);
- UnlockLists();
+ if(device) ALCdevice_DecRef(device);
}