changeset 1842:fea140a964b3

Patch from Ryan to fix compiler warnings
author Sam Lantinga <slouken@libsdl.org>
date Wed, 17 May 2006 04:01:53 +0000
parents 0495a8e98595
children c2c327e8e781
files src/video/x11/SDL_x11dyn.c
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11dyn.c	Tue May 16 16:25:22 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.c	Wed May 17 04:01:53 2006 +0000
@@ -61,30 +61,27 @@
     { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR },
 };
 
-static void *X11_GetSym(const char *fnname, int *rc)
+static void X11_GetSym(const char *fnname, int *rc, void **fn)
 {
 	int i;
-	void *fn = NULL;
 	for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
 		if (x11libs[i].lib != NULL)
 		{
-			fn = SDL_LoadFunction(x11libs[i].lib, fnname);
-			if (fn != NULL)
+			*fn = SDL_LoadFunction(x11libs[i].lib, fnname);
+			if (*fn != NULL)
 				break;
 		}
 	}
 
 	#if DEBUG_DYNAMIC_X11
-	if (fn != NULL)
-		printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn);
+	if (*fn != NULL)
+		printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, *fn);
 	else
 		printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
 	#endif
 
-	if (fn == NULL)
+	if (*fn == NULL)
 		*rc = 0;  /* kill this module. */
-
-	return fn;
 }
 
 
@@ -159,13 +156,13 @@
 			}
 		}
 		#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
-		#define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod);
+		#define SDL_X11_SYM(a,fn,x,y,z) X11_GetSym(#fn,thismod,(void**)&p##fn);
 		#include "SDL_x11sym.h"
 		#undef SDL_X11_MODULE
 		#undef SDL_X11_SYM
 
 		#ifdef X_HAVE_UTF8_STRING
-		pXCreateIC = X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8);
+		X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8,(void **)&pXCreateIC);
 		#endif
 
 		if (!SDL_X11_HAVE_BASEXLIB) {  /* some required symbol didn't load. */