diff options
author | Chris Robinson <[email protected]> | 2009-12-26 08:49:11 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-12-26 08:49:11 -0800 |
commit | c6340ce12d64062fa0723b2d24cb567bb375b378 (patch) | |
tree | e48bdbb3e0c82107f2e6d7e6df9b505b6d5d1844 /Alc/pulseaudio.c | |
parent | 7bc739e965ff45b5c9504d90883ffe167f7d50d3 (diff) |
Clean up some loading checks
Diffstat (limited to 'Alc/pulseaudio.c')
-rw-r--r-- | Alc/pulseaudio.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 621079f0..e4f53f4c 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -134,7 +134,7 @@ static const ALCchar pulse_capture_device[] = "PulseAudio Capture"; static volatile ALuint load_count; -void pulse_load(void) //{{{ +void *pulse_load(void) //{{{ { if(load_count == 0) { @@ -146,7 +146,7 @@ void pulse_load(void) //{{{ AL_PRINT("Could not load %s from libpulse-0.dll\n", #x); \ FreeLibrary(pa_handle); \ pa_handle = NULL; \ - return; \ + return NULL; \ } \ } while(0) #define LOAD_OPTIONAL_FUNC(x) do { \ @@ -169,7 +169,7 @@ void pulse_load(void) //{{{ AL_PRINT("Could not load %s from libpulse: %s\n", #x, err); \ dlclose(pa_handle); \ pa_handle = NULL; \ - return; \ + return NULL; \ } \ } while(0) #define LOAD_OPTIONAL_FUNC(x) do { \ @@ -187,7 +187,7 @@ void pulse_load(void) //{{{ #endif if(!pa_handle) - return; + return NULL; LOAD_FUNC(pa_context_unref); LOAD_FUNC(pa_sample_spec_valid); @@ -245,6 +245,8 @@ LOAD_OPTIONAL_FUNC(pa_stream_begin_write); #undef LOAD_FUNC } ++load_count; + + return pa_handle; } //}}} void pulse_unload(void) //{{{ @@ -489,8 +491,7 @@ static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_n else if(strcmp(device_name, pulse_device) != 0) return ALC_FALSE; - pulse_load(); - if(!pa_handle) + if(!pulse_load()) return ALC_FALSE; if(pulse_open(device, device_name) != ALC_FALSE) @@ -660,8 +661,7 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na else if(strcmp(device_name, pulse_capture_device) != 0) return ALC_FALSE; - pulse_load(); - if(!pa_handle) + if(!pulse_load()) return ALC_FALSE; if(pulse_open(device, device_name) == ALC_FALSE) @@ -904,8 +904,7 @@ void alc_pulse_deinit(void) //{{{ void alc_pulse_probe(int type) //{{{ { - pulse_load(); - if(!pa_handle) return; + if(!pulse_load()) return; if(type == DEVICE_PROBE) AppendDeviceList(pulse_device); |