src/video/x11/SDL_x11dyn.c
branchSDL-1.3
changeset 1659 14717b52abc0
parent 1648 9f59d4c5aaea
child 1662 782fd950bd46
child 1874 9e85b267f8f3
     1.1 --- a/src/video/x11/SDL_x11dyn.c	Mon May 01 06:58:33 2006 +0000
     1.2 +++ b/src/video/x11/SDL_x11dyn.c	Wed May 17 08:18:28 2006 +0000
     1.3 @@ -61,30 +61,27 @@
     1.4      { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR },
     1.5  };
     1.6  
     1.7 -static void *X11_GetSym(const char *fnname, int *rc)
     1.8 +static void X11_GetSym(const char *fnname, int *rc, void **fn)
     1.9  {
    1.10  	int i;
    1.11 -	void *fn = NULL;
    1.12  	for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
    1.13  		if (x11libs[i].lib != NULL)
    1.14  		{
    1.15 -			fn = SDL_LoadFunction(x11libs[i].lib, fnname);
    1.16 -			if (fn != NULL)
    1.17 +			*fn = SDL_LoadFunction(x11libs[i].lib, fnname);
    1.18 +			if (*fn != NULL)
    1.19  				break;
    1.20  		}
    1.21  	}
    1.22  
    1.23  	#if DEBUG_DYNAMIC_X11
    1.24 -	if (fn != NULL)
    1.25 -		printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn);
    1.26 +	if (*fn != NULL)
    1.27 +		printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, *fn);
    1.28  	else
    1.29  		printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
    1.30  	#endif
    1.31  
    1.32 -	if (fn == NULL)
    1.33 +	if (*fn == NULL)
    1.34  		*rc = 0;  /* kill this module. */
    1.35 -
    1.36 -	return fn;
    1.37  }
    1.38  
    1.39  
    1.40 @@ -159,13 +156,13 @@
    1.41  			}
    1.42  		}
    1.43  		#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
    1.44 -		#define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod);
    1.45 +		#define SDL_X11_SYM(a,fn,x,y,z) X11_GetSym(#fn,thismod,(void**)&p##fn);
    1.46  		#include "SDL_x11sym.h"
    1.47  		#undef SDL_X11_MODULE
    1.48  		#undef SDL_X11_SYM
    1.49  
    1.50  		#ifdef X_HAVE_UTF8_STRING
    1.51 -		pXCreateIC = X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8);
    1.52 +		X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8,(void **)&pXCreateIC);
    1.53  		#endif
    1.54  
    1.55  		if (!SDL_X11_HAVE_BASEXLIB) {  /* some required symbol didn't load. */