Let focus have a trailing comma.

This commit is contained in:
Nigel Tao committed 2017-11-04 10:21:32 +11:00
1 parent c62aa518a5
commit 0230a65c7b
1 file changed
+19 -14
+19 -14
View File
@@ -62,20 +62,25 @@ bool check_focus() {
q++; q++;
} }
// See if proc_funcname (with or without a "test_" or "bench_" prefix) if (p == q) {
// starts with the [p, q) string. // No-op. Skip empty focus targets, which makes it convenient to
if (!strncmp(proc_funcname, p, q - p)) { // copy/paste a string with a trailing comma.
return true; } else {
} // See if proc_funcname (with or without a "test_" or "bench_" prefix)
const char* unprefixed_proc_funcname = NULL; // starts with the [p, q) string.
if (!strncmp(proc_funcname, "test_", 5)) { if (!strncmp(proc_funcname, p, q - p)) {
unprefixed_proc_funcname = proc_funcname + 5; return true;
} else if (!strncmp(proc_funcname, "bench_", 6)) { }
unprefixed_proc_funcname = proc_funcname + 6; const char* unprefixed_proc_funcname = NULL;
} if (!strncmp(proc_funcname, "test_", 5)) {
if (unprefixed_proc_funcname && unprefixed_proc_funcname = proc_funcname + 5;
!strncmp(unprefixed_proc_funcname, p, q - p)) { } else if (!strncmp(proc_funcname, "bench_", 6)) {
return true; unprefixed_proc_funcname = proc_funcname + 6;
}
if (unprefixed_proc_funcname &&
!strncmp(unprefixed_proc_funcname, p, q - p)) {
return true;
}
} }
if (*q == '\x00') { if (*q == '\x00') {