summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2014-06-09 05:21:37 -0700
committerBrian Paul <brianp@vmware.com>2014-06-10 19:14:02 -0600
commited814523b0ea7f6799c4bad13c4f1e5273c85348 (patch)
tree976d59ef1c69cfd230bae7a36085f9d58c5dc6cb
parentd3566c6f374f6a91bb4f7907511bad98b38060e2 (diff)
glinfo_common: fix extension_supported() function
The code did not correctly handle super-string handling. For example, if we were searching for "WGL_ARB_pixel_format" but we found "WGL_ARB_pixel_format_float" we'd stop searching and return 0. Now we search past that initial, incorrect match. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--src/xdemos/glinfo_common.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c
index 3cbe4edc..88bb9295 100644
--- a/src/xdemos/glinfo_common.c
+++ b/src/xdemos/glinfo_common.c
@@ -310,12 +310,22 @@ build_core_profile_extension_list(const struct ext_functions *extfuncs)
GLboolean
extension_supported(const char *ext, const char *extensionsList)
{
- const char *p = strstr(extensionsList, ext);
- if (p) {
- /* check that next char is a space or end of string */
- int extLen = strlen(ext);
- if (p[extLen] == 0 || p[extLen] == ' ')
- return 1;
+ while (1) {
+ const char *p = strstr(extensionsList, ext);
+ if (p) {
+ /* check that next char is a space or end of string */
+ int extLen = strlen(ext);
+ if (p[extLen] == 0 || p[extLen] == ' ') {
+ return 1;
+ }
+ else {
+ /* We found a superset string, keep looking */
+ extensionsList += extLen;
+ }
+ }
+ else {
+ break;
+ }
}
return 0;
}