Don't use the enumerator variable.

This commit is contained in:
Jari Vetoniemi 2014-04-15 20:14:42 +03:00
parent f77ae857b1
commit 88590ddcfe

View File

@ -403,15 +403,15 @@ static void _bmDrawCursesResizeHandler(int sig)
int _bmDrawCursesInit(struct _bmRenderApi *api) int _bmDrawCursesInit(struct _bmRenderApi *api)
{ {
memset(&curses, 0, sizeof(curses)); memset(&curses, 0, sizeof(curses));
const char *lib = NULL, *func = NULL;
unsigned int i; unsigned int i;
for (i = 0; DL_PATH[i] && !curses.handle; ++i) for (i = 0; DL_PATH[i] && !curses.handle; ++i)
curses.handle = dlopen(DL_PATH[i], RTLD_LAZY); curses.handle = dlopen((lib = DL_PATH[i]), RTLD_LAZY);
if (!curses.handle) if (!curses.handle)
return 0; return 0;
char *func = NULL;
#define bmLoadFunction(x) (curses.x = dlsym(curses.handle, (func = #x))) #define bmLoadFunction(x) (curses.x = dlsym(curses.handle, (func = #x)))
if (!bmLoadFunction(initscr)) if (!bmLoadFunction(initscr))
@ -473,7 +473,7 @@ int _bmDrawCursesInit(struct _bmRenderApi *api)
return 1; return 1;
function_pointer_exception: function_pointer_exception:
fprintf(stderr, "-!- Could not load function '%s' from '%s'\n", func, DL_PATH[i]); fprintf(stderr, "-!- Could not load function '%s' from '%s'\n", func, lib);
_bmDrawCursesFree(); _bmDrawCursesFree();
return 0; return 0;
} }