Skip to content

Commit

Permalink
f2fs: use strncasecmp() simplify the string comparison
Browse files Browse the repository at this point in the history
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
  • Loading branch information
Gu Zheng authored and Jaegeuk Kim committed Aug 27, 2013
1 parent 8cb8268 commit 749ebfd
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions fs/f2fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 749ebfd

Please sign in to comment.