Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed Feb 18, 2015
1 parent 052720f commit f0c061d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/video/x11/SDL_x11opengl.c
Expand Up @@ -279,14 +279,14 @@ HasExtension(const char *extension, const char *extensions)
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. */
Expand Down

0 comments on commit f0c061d

Please sign in to comment.