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. --HG-- extra : rebase_source : 72564776aed4ab255a65880e979f8dba4df4a527
This commit is contained in:
parent
6c134a60d0
commit
21282ee01f
1 changed files with 3 additions and 3 deletions
|
@ -279,14 +279,14 @@ HasExtension(const char *extension, const char *extensions)
|
||||||
const char *start;
|
const char *start;
|
||||||
const char *where, *terminator;
|
const char *where, *terminator;
|
||||||
|
|
||||||
|
if (!extensions)
|
||||||
|
return SDL_FALSE;
|
||||||
|
|
||||||
/* Extension names should not have spaces. */
|
/* Extension names should not have spaces. */
|
||||||
where = SDL_strchr(extension, ' ');
|
where = SDL_strchr(extension, ' ');
|
||||||
if (where || *extension == '\0')
|
if (where || *extension == '\0')
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
|
|
||||||
if (!extensions)
|
|
||||||
return SDL_FALSE;
|
|
||||||
|
|
||||||
/* It takes a bit of care to be fool-proof about parsing the
|
/* It takes a bit of care to be fool-proof about parsing the
|
||||||
* OpenGL extensions string. Don't be fooled by sub-strings,
|
* OpenGL extensions string. Don't be fooled by sub-strings,
|
||||||
* etc. */
|
* etc. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue