diff options
author | Chris Robinson <[email protected]> | 2011-08-18 23:56:11 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-18 23:56:11 -0700 |
commit | 0b0588cc37c7be4c94563366d6d3e004f3a6e9fb (patch) | |
tree | fde7fb7a33801cd8c65c92a21e9f3393dd3c3f77 /Alc/sndio.c | |
parent | 742bb12498bd144388a7f2347d9c941c228a7270 (diff) |
Load backend libs on init
Diffstat (limited to 'Alc/sndio.c')
-rw-r--r-- | Alc/sndio.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Alc/sndio.c b/Alc/sndio.c index ba6063dd..aa6ac0e4 100644 --- a/Alc/sndio.c +++ b/Alc/sndio.c @@ -74,22 +74,21 @@ MAKE_FUNC(sio_onvol); #endif -void *sndio_load(void) +static ALCboolean sndio_load(void) { if(!sndio_handle) { #ifdef HAVE_DYNLOAD sndio_handle = LoadLib("libsndio.so"); if(!sndio_handle) - return NULL; + return ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(sndio_handle, #f); \ - if(p##f == NULL) \ - { \ + if(p##f == NULL) { \ CloseLib(sndio_handle); \ sndio_handle = NULL; \ - return NULL; \ + return ALC_FALSE; \ } \ } while(0) LOAD_FUNC(sio_initpar); @@ -114,7 +113,7 @@ void *sndio_load(void) sndio_handle = (void*)0xDEADBEEF; #endif } - return sndio_handle; + return ALC_TRUE; } @@ -170,9 +169,6 @@ static ALCboolean sndio_open_playback(ALCdevice *device, const ALCchar *deviceNa { sndio_data *data; - if(!sndio_load()) - return ALC_FALSE; - if(!deviceName) deviceName = sndio_device; else if(strcmp(deviceName, sndio_device) != 0) @@ -362,6 +358,8 @@ static const BackendFuncs sndio_funcs = { ALCboolean alc_sndio_init(BackendFuncs *func_list) { + if(!sndio_load()) + return ALC_FALSE; *func_list = sndio_funcs; return ALC_TRUE; } @@ -377,9 +375,6 @@ void alc_sndio_deinit(void) void alc_sndio_probe(enum DevProbe type) { - if(!sndio_load()) - return; - switch(type) { case DEVICE_PROBE: |