Declare variables closer to where they're used

master
Chris Robinson 2022-07-18 11:10:27 -07:00
parent 0650d4ee70
commit 650a6d49e9
1 changed files with 2 additions and 4 deletions

View File

@ -623,7 +623,6 @@ int AlsaPlayback::mixerNoMMapProc()
void AlsaPlayback::open(const char *name)
{
al::optional<std::string> driveropt;
const char *driver{"default"};
if(name)
{
@ -640,7 +639,7 @@ void AlsaPlayback::open(const char *name)
else
{
name = alsaDevice;
if(bool{driveropt = ConfigValueStr(nullptr, "alsa", "device")})
if(auto driveropt = ConfigValueStr(nullptr, "alsa", "device"))
driver = driveropt->c_str();
}
TRACE("Opening device \"%s\"\n", driver);
@ -896,7 +895,6 @@ AlsaCapture::~AlsaCapture()
void AlsaCapture::open(const char *name)
{
al::optional<std::string> driveropt;
const char *driver{"default"};
if(name)
{
@ -913,7 +911,7 @@ void AlsaCapture::open(const char *name)
else
{
name = alsaDevice;
if(bool{driveropt = ConfigValueStr(nullptr, "alsa", "capture")})
if(auto driveropt = ConfigValueStr(nullptr, "alsa", "capture"))
driver = driveropt->c_str();
}