提交 494a5e12 编写于 作者: A Andy Shevchenko 提交者: Simon Glass

test: Use positive conditional in test_matches()

It is easier to read the positive conditional.

While at it, convert hard coded length of "_test_" to strlen("_test_")
which will be converted to a constant bu optimizing compiler.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 ff232a72
......@@ -148,16 +148,16 @@ static bool test_matches(const char *prefix, const char *test_name,
if (!strncmp(test_name, select_name, len))
return true;
if (!prefix) {
if (prefix) {
/* All tests have this prefix */
if (!strncmp(test_name, prefix, strlen(prefix)))
test_name += strlen(prefix);
} else {
const char *p = strstr(test_name, "_test_");
/* convert xxx_test_yyy to yyy, i.e. remove the suite name */
if (p)
test_name = p + 6;
} else {
/* All tests have this prefix */
if (!strncmp(test_name, prefix, strlen(prefix)))
test_name += strlen(prefix);
test_name = p + strlen("_test_");
}
if (!strncmp(test_name, select_name, len))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册