From 61f7e7716c6743b16051d8c3ea4cea3b27d0197b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 14 Apr 2019 02:16:42 -0700 Subject: Remove the backend factory deinit method It was never actually called anywhere, and there's no safe place where it can be called. It's probably better to let the individual backends worry about cleaning themselves up anyway. --- Alc/backends/alsa.cpp | 80 +++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 48 deletions(-) (limited to 'Alc/backends/alsa.cpp') diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp index 1a287565..9f036a01 100644 --- a/Alc/backends/alsa.cpp +++ b/Alc/backends/alsa.cpp @@ -204,46 +204,6 @@ ALSA_FUNCS(MAKE_FUNC); #endif -bool alsa_load() -{ - bool error{false}; - -#ifdef HAVE_DYNLOAD - if(!alsa_handle) - { - std::string missing_funcs; - - alsa_handle = LoadLib("libasound.so.2"); - if(!alsa_handle) - { - WARN("Failed to load %s\n", "libasound.so.2"); - return ALC_FALSE; - } - - error = ALC_FALSE; -#define LOAD_FUNC(f) do { \ - p##f = reinterpret_cast(GetSymbol(alsa_handle, #f)); \ - if(p##f == nullptr) { \ - error = true; \ - missing_funcs += "\n" #f; \ - } \ -} while(0) - ALSA_FUNCS(LOAD_FUNC); -#undef LOAD_FUNC - - if(error) - { - WARN("Missing expected functions:%s\n", missing_funcs.c_str()); - CloseLib(alsa_handle); - alsa_handle = nullptr; - } - } -#endif - - return !error; -} - - struct DevMap { std::string name; std::string device_name; @@ -1249,18 +1209,42 @@ ClockLatency AlsaCapture::getClockLatency() bool AlsaBackendFactory::init() -{ return !!alsa_load(); } - -void AlsaBackendFactory::deinit() { - PlaybackDevices.clear(); - CaptureDevices.clear(); + bool error{false}; #ifdef HAVE_DYNLOAD - if(alsa_handle) - CloseLib(alsa_handle); - alsa_handle = nullptr; + if(!alsa_handle) + { + std::string missing_funcs; + + alsa_handle = LoadLib("libasound.so.2"); + if(!alsa_handle) + { + WARN("Failed to load %s\n", "libasound.so.2"); + return ALC_FALSE; + } + + error = ALC_FALSE; +#define LOAD_FUNC(f) do { \ + p##f = reinterpret_cast(GetSymbol(alsa_handle, #f)); \ + if(p##f == nullptr) { \ + error = true; \ + missing_funcs += "\n" #f; \ + } \ +} while(0) + ALSA_FUNCS(LOAD_FUNC); +#undef LOAD_FUNC + + if(error) + { + WARN("Missing expected functions:%s\n", missing_funcs.c_str()); + CloseLib(alsa_handle); + alsa_handle = nullptr; + } + } #endif + + return !error; } bool AlsaBackendFactory::querySupport(BackendType type) -- cgit v1.2.3