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

Unified Diff: gm/gmmain.cpp

Issue 19807005: refactor duplication (shouldSkip and skip_name) into a utility function (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Forced linking is required, shouldn't have removed it Created 7 years, 5 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 | « bench/benchmain.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gmmain.cpp
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 01eaaebffd8a6a9ff4cb1f87ae6adfcca5745ebe..958a511eb7446dc07e12313b6b73684508aca76c 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1410,38 +1410,6 @@ static int findConfig(const char config[]) {
return -1;
}
-static bool skip_name(SkCommandLineFlags::StringArray array, const char name[]) {
- // FIXME: this duplicates the logic in test/skia_test.cpp -- consolidate
- int count = array.count();
- size_t testLen = strlen(name);
- bool anyExclude = count == 0;
- for (int i = 0; i < array.count(); ++i) {
- const char* matchName = array[i];
- size_t matchLen = strlen(matchName);
- bool matchExclude, matchStart, matchEnd;
- if ((matchExclude = matchName[0] == '~')) {
- anyExclude = true;
- matchName++;
- matchLen--;
- }
- if ((matchStart = matchName[0] == '^')) {
- matchName++;
- matchLen--;
- }
- if ((matchEnd = matchName[matchLen - 1] == '$')) {
- matchLen--;
- }
- if (matchStart ? (!matchEnd || matchLen == testLen)
- && strncmp(name, matchName, matchLen) == 0
- : matchEnd ? matchLen <= testLen
- && strncmp(name + testLen - matchLen, matchName, matchLen) == 0
- : strstr(name, matchName) != 0) {
- return matchExclude;
- }
- }
- return !anyExclude;
-}
-
namespace skiagm {
#if SK_SUPPORT_GPU
SkAutoTUnref<GrContext> gGrContext;
@@ -2076,7 +2044,12 @@ int tool_main(int argc, char** argv) {
}
const char* shortName = gm->shortName();
- if (skip_name(FLAGS_match, shortName)) {
+
+ SkTDArray<const char*> matchStrs;
+ for (int i = 0; i < FLAGS_match.count(); ++i) {
+ matchStrs.push(FLAGS_match[i]);
+ }
+ if (SkCommandLineFlags::ShouldSkip(matchStrs, shortName)) {
continue;
}
« no previous file with comments | « bench/benchmain.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698