Mercurial > sdl-ios-xcode
diff src/loadso/dlopen/SDL_sysloadso.c @ 1895:c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 21:04:37 +0000 |
parents | 92947e3a18db |
children | b656e6f09be3 |
line wrap: on
line diff
--- a/src/loadso/dlopen/SDL_sysloadso.c Thu Jul 06 18:01:37 2006 +0000 +++ b/src/loadso/dlopen/SDL_sysloadso.c Mon Jul 10 21:04:37 2006 +0000 @@ -31,38 +31,43 @@ #include "SDL_loadso.h" -void *SDL_LoadObject(const char *sofile) +void * +SDL_LoadObject(const char *sofile) { - void *handle = dlopen(sofile, RTLD_NOW); - const char *loaderror = (char *)dlerror(); - if ( handle == NULL ) { - SDL_SetError("Failed loading %s: %s", sofile, loaderror); - } - return(handle); + void *handle = dlopen(sofile, RTLD_NOW); + const char *loaderror = (char *) dlerror(); + if (handle == NULL) { + SDL_SetError("Failed loading %s: %s", sofile, loaderror); + } + return (handle); } -void *SDL_LoadFunction(void *handle, const char *name) +void * +SDL_LoadFunction(void *handle, const char *name) { - void *symbol = dlsym(handle, name); - if ( symbol == NULL ) { - size_t len = 1+SDL_strlen(name)+1; - char *_name = SDL_stack_alloc(char, len); - _name[0] = '_'; - SDL_strlcpy(&_name[1], name, len); - symbol = dlsym(handle, name); - SDL_stack_free(_name); - if ( symbol == NULL ) { - SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror()); - } - } - return(symbol); + void *symbol = dlsym(handle, name); + if (symbol == NULL) { + size_t len = 1 + SDL_strlen(name) + 1; + char *_name = SDL_stack_alloc(char, len); + _name[0] = '_'; + SDL_strlcpy(&_name[1], name, len); + symbol = dlsym(handle, name); + SDL_stack_free(_name); + if (symbol == NULL) { + SDL_SetError("Failed loading %s: %s", name, + (const char *) dlerror()); + } + } + return (symbol); } -void SDL_UnloadObject(void *handle) +void +SDL_UnloadObject(void *handle) { - if ( handle != NULL ) { - dlclose(handle); - } + if (handle != NULL) { + dlclose(handle); + } } #endif /* SDL_LOADSO_DLOPEN */ +/* vi: set ts=4 sw=4 expandtab: */