aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dm/DM.cpp')
-rw-r--r--dm/DM.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 274ec2a815..8c30fe6b55 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -6,7 +6,6 @@
#include "SkCommandLineFlags.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
-#include "SkString.h"
#include "gm.h"
#include "DMReporter.h"
@@ -40,6 +39,19 @@ DEFINE_string(config, "8888 gpu",
__SK_FORCE_IMAGE_DECODER_LINKING;
+// Split str on any characters in delimiters into out. (Think, strtok with a sane API.)
+static void split(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;
+ // Skip any delimiters.
+ str += strspn(str, delimiters);
+ }
+}
+
// "FooBar" -> "foobar". Obviously, ASCII only.
static SkString lowercase(SkString s) {
for (size_t i = 0; i < s.size(); i++) {
@@ -122,7 +134,7 @@ int tool_main(int argc, char** argv) {
GM::SetResourcePath(FLAGS_resources[0]);
SkTArray<SkString> configs;
for (int i = 0; i < FLAGS_config.count(); i++) {
- SkStrSplit(FLAGS_config[i], ", ", &configs);
+ split(FLAGS_config[i], ", ", &configs);
}
SkTDArray<GMRegistry::Factory> gms;