Merged r2903:2904 from SDL-1.2 branch to trunk: BeOS loadso updates.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 07 Nov 2006 15:18:42 +0000
changeset 2069 8d4c2498bb72
parent 2068 f16a7d02a176
child 2070 dbfa1ebd73b0
Merged r2903:2904 from SDL-1.2 branch to trunk: BeOS loadso updates.
src/loadso/beos/SDL_sysloadso.c
--- a/src/loadso/beos/SDL_sysloadso.c	Tue Nov 07 15:02:12 2006 +0000
+++ b/src/loadso/beos/SDL_sysloadso.c	Tue Nov 07 15:18:42 2006 +0000
@@ -35,35 +35,25 @@
 SDL_LoadObject(const char *sofile)
 {
     void *handle = NULL;
-    const char *loaderror = "Unknown error";
     image_id library_id = load_add_on(sofile);
-    if (library_id == B_ERROR) {
-        loaderror = "BeOS error";
+    if (library_id < 0) {
+        SDL_SetError(strerror((int) library_id));
     } else {
         handle = (void *) (library_id);
     }
-
-    if (handle == NULL) {
-        SDL_SetError("Failed loading %s: %s", sofile, loaderror);
-    }
     return (handle);
 }
 
 void *
 SDL_LoadFunction(void *handle, const char *name)
 {
-    void *symbol = NULL;
-    const char *loaderror = "Unknown error";
+    void *sym = NULL;
     image_id library_id = (image_id) handle;
-    if (get_image_symbol(library_id,
-                         name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR) {
-        loaderror = "Symbol not found";
+    status_t rc = get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
+    if (rc != B_NO_ERROR) {
+        SDL_SetError(strerror(rc));
     }
-
-    if (symbol == NULL) {
-        SDL_SetError("Failed loading %s: %s", name, loaderror);
-    }
-    return (symbol);
+    return (sym);
 }
 
 void
@@ -77,4 +67,6 @@
 }
 
 #endif /* SDL_LOADSO_BEOS */
+
 /* vi: set ts=4 sw=4 expandtab: */
+