diff options
author | Chris Robinson <[email protected]> | 2012-03-01 03:37:06 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-03-01 03:46:45 -0800 |
commit | 85daab0d5e66534df03dfebd2dc42641398dd29a (patch) | |
tree | 74331d9f94a75ac964e436af022afaf8f08c5c54 /Alc | |
parent | 105faa193551b0272f62aab3e67f305d3ceeb3e5 (diff) |
Don't define lib handles when dynamic loading is disabled
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/alsa.c | 8 | ||||
-rw-r--r-- | Alc/backends/portaudio.c | 24 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.c | 12 | ||||
-rw-r--r-- | Alc/backends/sndio.c | 8 |
4 files changed, 24 insertions, 28 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 7b46a9c2..cf0fd378 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -32,8 +32,8 @@ static const ALCchar alsaDevice[] = "ALSA Default"; -static void *alsa_handle; #ifdef HAVE_DYNLOAD +static void *alsa_handle; #define MAKE_FUNC(f) static typeof(f) * p##f MAKE_FUNC(snd_strerror); MAKE_FUNC(snd_pcm_open); @@ -172,9 +172,9 @@ MAKE_FUNC(snd_card_next); static ALCboolean alsa_load(void) { +#ifdef HAVE_DYNLOAD if(!alsa_handle) { -#ifdef HAVE_DYNLOAD alsa_handle = LoadLib("libasound.so.2"); if(!alsa_handle) return ALC_FALSE; @@ -253,10 +253,8 @@ static ALCboolean alsa_load(void) LOAD_FUNC(snd_ctl_card_info_get_id); LOAD_FUNC(snd_card_next); #undef LOAD_FUNC -#else - alsa_handle = (void*)0xDEADBEEF; -#endif } +#endif return ALC_TRUE; } diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c index 2ac668b8..81622494 100644 --- a/Alc/backends/portaudio.c +++ b/Alc/backends/portaudio.c @@ -33,8 +33,8 @@ static const ALCchar pa_device[] = "PortAudio Default"; -static void *pa_handle; #ifdef HAVE_DYNLOAD +static void *pa_handle; #define MAKE_FUNC(x) static typeof(x) * p##x MAKE_FUNC(Pa_Initialize); MAKE_FUNC(Pa_Terminate); @@ -60,11 +60,11 @@ MAKE_FUNC(Pa_GetStreamInfo); static ALCboolean pa_load(void) { - if(!pa_handle) - { - PaError err; + PaError err; #ifdef HAVE_DYNLOAD + if(!pa_handle) + { #ifdef _WIN32 # define PALIB "portaudio.dll" #elif defined(__APPLE__) && defined(__MACH__) @@ -98,9 +98,6 @@ static ALCboolean pa_load(void) LOAD_FUNC(Pa_GetDefaultOutputDevice); LOAD_FUNC(Pa_GetStreamInfo); #undef LOAD_FUNC -#else - pa_handle = (void*)0xDEADBEEF; -#endif if((err=Pa_Initialize()) != paNoError) { @@ -110,6 +107,13 @@ static ALCboolean pa_load(void) return ALC_FALSE; } } +#else + if((err=Pa_Initialize()) != paNoError) + { + ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err)); + return ALC_FALSE; + } +#endif return ALC_TRUE; } @@ -424,14 +428,16 @@ ALCboolean alc_pa_init(BackendFuncs *func_list) void alc_pa_deinit(void) { +#ifdef HAVE_DYNLOAD if(pa_handle) { Pa_Terminate(); -#ifdef HAVE_DYNLOAD CloseLib(pa_handle); -#endif pa_handle = NULL; } +#else + Pa_Terminate(); +#endif } void alc_pa_probe(enum DevProbe type) diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 1acdff71..e6d54835 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -34,8 +34,8 @@ (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro))) #endif -static void *pa_handle; #ifdef HAVE_DYNLOAD +static void *pa_handle; #define MAKE_FUNC(x) static typeof(x) * p##x MAKE_FUNC(pa_context_unref); MAKE_FUNC(pa_sample_spec_valid); @@ -273,10 +273,9 @@ static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) static ALCboolean pulse_load(void) //{{{ { ALCboolean ret = ALC_TRUE; +#ifdef HAVE_DYNLOAD if(!pa_handle) { -#ifdef HAVE_DYNLOAD - #ifdef _WIN32 #define PALIB "libpulse-0.dll" #elif defined(__APPLE__) && defined(__MACH__) @@ -366,18 +365,13 @@ static ALCboolean pulse_load(void) //{{{ #endif #undef LOAD_OPTIONAL_FUNC -#else /* HAVE_DYNLOAD */ - pa_handle = (void*)0xDEADBEEF; -#endif - if(ret == ALC_FALSE) { -#ifdef HAVE_DYNLOAD CloseLib(pa_handle); -#endif pa_handle = NULL; } } +#endif /* HAVE_DYNLOAD */ return ret; } //}}} diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c index 4866a0a5..6be98c2f 100644 --- a/Alc/backends/sndio.c +++ b/Alc/backends/sndio.c @@ -33,8 +33,8 @@ static const ALCchar sndio_device[] = "SndIO Default"; -static void *sndio_handle; #ifdef HAVE_DYNLOAD +static void *sndio_handle; #define MAKE_FUNC(x) static typeof(x) * p##x MAKE_FUNC(sio_initpar); MAKE_FUNC(sio_open); @@ -76,9 +76,9 @@ MAKE_FUNC(sio_onvol); static ALCboolean sndio_load(void) { +#ifdef HAVE_DYNLOAD if(!sndio_handle) { -#ifdef HAVE_DYNLOAD sndio_handle = LoadLib("libsndio.so"); if(!sndio_handle) return ALC_FALSE; @@ -109,10 +109,8 @@ static ALCboolean sndio_load(void) LOAD_FUNC(sio_setvol); LOAD_FUNC(sio_onvol); #undef LOAD_FUNC -#else - sndio_handle = (void*)0xDEADBEEF; -#endif } +#endif return ALC_TRUE; } |