Skip to content
Browse files

[SEGFAULTING and WARNINGS] this should have worked. Compiler gaurds f…

…or SDL_getenv
  • Loading branch information...
1 parent 5f05512 commit 3d9320cbfedf1aa41709d0ee653132410a64fe5d @kthakore kthakore committed
Showing with 15 additions and 2 deletions.
  1. +15 −2 src/SDL.xs
View
17 src/SDL.xs
@@ -116,7 +116,12 @@ void handler(int sig) {
void
windows_force_driver()
{
- char *test = SDL_getenv("SDL_VIDEODRIVER");
+ char *test;
+#if SDL_MAJOR_VERSION >= 1 && SDL_MINOR_VERSION >= 2 && SDL_PATCHLEVEL >= 9
+ *test = (char *)SDL_getenv("SDL_VIDEODRIVER");
+#else
+ *test = getenv("SDL_VIDEODRIVER");
+#endif
if(!test || 0 != strcmp("dummy", test))
{
#if SDL_MAJOR_VERSION >= 1 && SDL_MINOR_VERSION >= 2 && SDL_PATCHLEVEL >= 14
@@ -265,7 +270,15 @@ char*
getenv (name)
char *name
CODE:
- RETVAL = SDL_getenv(name);
+ char *test;
+ /* SDL version 1.2.9 doesn't have SDL_getenv */
+#if SDL_MAJOR_VERSION >= 1 && SDL_MINOR_VERSION >= 2 && SDL_PATCHLEVEL >= 9
+ *test = (char *)SDL_getenv(name);
+ warn("Ran SDL_getenv");
+#else
+ *test = getenv(name);
+#endif
+ RETVAL = test;
OUTPUT:
RETVAL

0 comments on commit 3d9320c

Please sign in to comment.
Something went wrong with that request. Please try again.