diff options
author | Chris Robinson <[email protected]> | 2019-06-29 15:04:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-29 15:04:20 -0700 |
commit | c7797fa10fa35e607db61f4a37d0b35761f02e4e (patch) | |
tree | c5bda96be44d2e6ef66925c7547d29cd82a5d49e /Alc/alc.cpp | |
parent | 811d0738fae78946712b17904b5d24c4b4af13ca (diff) |
Declare variables closer to their use
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r-- | Alc/alc.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 8831cebd..0e395a89 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -2748,7 +2748,6 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para START_API_FUNC { const ALCchar *value = nullptr; - DeviceRef dev; switch(param) { @@ -2781,8 +2780,7 @@ START_API_FUNC break; case ALC_ALL_DEVICES_SPECIFIER: - dev = VerifyDevice(Device); - if(dev) + if(DeviceRef dev{VerifyDevice(Device)}) value = dev->DeviceName.c_str(); else { @@ -2792,8 +2790,7 @@ START_API_FUNC break; case ALC_CAPTURE_DEVICE_SPECIFIER: - dev = VerifyDevice(Device); - if(dev) + if(DeviceRef dev{VerifyDevice(Device)}) value = dev->DeviceName.c_str(); else { @@ -2826,25 +2823,24 @@ START_API_FUNC break; case ALC_EXTENSIONS: - dev = VerifyDevice(Device); - if(dev) value = alcExtensionList; - else value = alcNoDeviceExtList; + if(VerifyDevice(Device)) + value = alcExtensionList; + else + value = alcNoDeviceExtList; break; case ALC_HRTF_SPECIFIER_SOFT: - dev = VerifyDevice(Device); - if(!dev) - alcSetError(nullptr, ALC_INVALID_DEVICE); - else + if(DeviceRef dev{VerifyDevice(Device)}) { std::lock_guard<std::mutex> _{dev->StateLock}; value = (dev->mHrtf ? dev->HrtfName.c_str() : ""); } + else + alcSetError(nullptr, ALC_INVALID_DEVICE); break; default: - dev = VerifyDevice(Device); - alcSetError(dev.get(), ALC_INVALID_ENUM); + alcSetError(VerifyDevice(Device).get(), ALC_INVALID_ENUM); break; } |