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

Unified Diff: src/core/SkString.cpp

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: fix errorneous config handling Created 5 years 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
Index: src/core/SkString.cpp
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index d93f662da3d8bc0a80ca96903752bbcc3977ba1e..39347aa493f3a5183d82ff6bb904254d041c72b9 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -624,16 +624,35 @@ SkString SkStringPrintf(const char* format, ...) {
return formattedOutput;
}
-void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out) {
- const char* end = str + strlen(str);
- while (str != end) {
- // Find a token.
- const size_t len = strcspn(str, delimiters);
- out->push_back().set(str, len);
- str += len;
+void SkStrSplit(const char* str, const char* delimiters, SkStrSplitResult resultBehavior,
+ SkTArray<SkString>* out) {
+ if (resultBehavior != kAll_SkStrSplitResult) {
scroggo 2015/12/07 13:27:52 Why not if (resultBehavior == kNonEmpty_SkStrSpli
Kimmo Kinnunen 2015/12/08 09:07:51 Done.
// Skip any delimiters.
str += strspn(str, delimiters);
}
+ if (!*str) {
+ return;
+ }
+
+ while (true) {
+ // Find a token.
+ const size_t len = strcspn(str, delimiters);
+ if (resultBehavior == kAll_SkStrSplitResult || len > 0) {
+ out->push_back().set(str, len);
+ str += len;
+ }
+
+ if (!*str) {
+ return;
+ }
+ if (resultBehavior != kAll_SkStrSplitResult) {
+ // Skip any delimiters.
+ str += strspn(str, delimiters);
+ } else {
+ // Skip one delimiter.
+ str += 1;
+ }
+ }
}
#undef VSNPRINTF

Powered by Google App Engine
This is Rietveld 408576698