glX HasExtension(): check for NULL ext string first.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 17 Feb 2015 22:59:56 -0500
changeset 9354 5709598d628a
parent 9353 4528766f5d2c
child 9355 0d1e81f10b7e
glX HasExtension(): check for NULL ext string first. It's slightly faster than failing later, after a strchr() call, since this will get called multiple times with a NULL string if the system totally fails elsewhere.
src/video/x11/SDL_x11opengl.c
--- a/src/video/x11/SDL_x11opengl.c	Sun Feb 15 21:47:10 2015 +0100
+++ b/src/video/x11/SDL_x11opengl.c	Tue Feb 17 22:59:56 2015 -0500
@@ -279,14 +279,14 @@
     const char *start;
     const char *where, *terminator;
 
+    if (!extensions)
+        return SDL_FALSE;
+
     /* Extension names should not have spaces. */
     where = SDL_strchr(extension, ' ');
     if (where || *extension == '\0')
         return SDL_FALSE;
 
-    if (!extensions)
-        return SDL_FALSE;
-
     /* It takes a bit of care to be fool-proof about parsing the
      * OpenGL extensions string. Don't be fooled by sub-strings,
      * etc. */