glX HasExtension(): check for NULL ext string first.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 17 Feb 2015 22:59:56 -0500
changeset 93545709598d628a
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
     1.1 --- a/src/video/x11/SDL_x11opengl.c	Sun Feb 15 21:47:10 2015 +0100
     1.2 +++ b/src/video/x11/SDL_x11opengl.c	Tue Feb 17 22:59:56 2015 -0500
     1.3 @@ -279,14 +279,14 @@
     1.4      const char *start;
     1.5      const char *where, *terminator;
     1.6  
     1.7 +    if (!extensions)
     1.8 +        return SDL_FALSE;
     1.9 +
    1.10      /* Extension names should not have spaces. */
    1.11      where = SDL_strchr(extension, ' ');
    1.12      if (where || *extension == '\0')
    1.13          return SDL_FALSE;
    1.14  
    1.15 -    if (!extensions)
    1.16 -        return SDL_FALSE;
    1.17 -
    1.18      /* It takes a bit of care to be fool-proof about parsing the
    1.19       * OpenGL extensions string. Don't be fooled by sub-strings,
    1.20       * etc. */