提交 749ebfd1 编写于 作者: G Gu Zheng 提交者: Jaegeuk Kim

f2fs: use strncasecmp() simplify the string comparison

Signed-off-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
上级 8cb82688
......@@ -83,21 +83,11 @@ static int is_multimedia_file(const unsigned char *s, const char *sub)
{
size_t slen = strlen(s);
size_t sublen = strlen(sub);
int ret;
if (sublen > slen)
return 0;
ret = memcmp(s + slen - sublen, sub, sublen);
if (ret) { /* compare upper case */
int i;
char upper_sub[8];
for (i = 0; i < sublen && i < sizeof(upper_sub); i++)
upper_sub[i] = toupper(sub[i]);
return !memcmp(s + slen - sublen, upper_sub, sublen);
}
return !ret;
return !strncasecmp(s + slen - sublen, sub, sublen);
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册