Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: src/gpu/gl/GrGLExtensions.cpp

Issue 12564003: Fix extensions string (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Upload correct patch Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLExtensions.cpp
===================================================================
--- src/gpu/gl/GrGLExtensions.cpp (revision 8037)
+++ src/gpu/gl/GrGLExtensions.cpp (working copy)
@@ -51,27 +51,20 @@
if (NULL == extensions) {
return false;
}
- // First count the extensions so that we don't cause the array to malloc multiple times.
- int extensionCnt = 1;
- const char* e = (const char*) extensions;
- while (NULL != (e = strchr(e+1, ' '))) {
- e += 1;
- ++extensionCnt;
- }
- fStrings.push_back_n(extensionCnt);
-
- int i = 0;
while (true) {
- size_t length = strcspn(extensions, " ");
- GrAssert(i < extensionCnt);
- fStrings[i].set(extensions, length);
- ++i;
- if ('\0' == extensions[length]) {
+ // skip over multiple spaces between extensions
+ while (' ' == *extensions) {
+ ++extensions;
+ }
+ // quit once we reach the end of the string.
+ if ('\0' == *extensions) {
break;
}
- extensions += length + 1;
+ // we found an extension
+ size_t length = strcspn(extensions, " ");
+ fStrings.push_back().set(extensions, length);
+ extensions += length;
}
- GrAssert(i == extensionCnt);
}
SkTSearchCompareLTFunctor<SkString, extension_compare> cmp;
SkTQSort(&fStrings.front(), &fStrings.back(), cmp);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698