diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2013-08-22 06:11:25 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-08-27 08:50:12 -0400 |
commit | 749ebfd174bd6fca3083da5f1e7933cbd60316c9 (patch) | |
tree | 4a644edddeade064deb652523995c3603b5bb5ef /fs | |
parent | 8cb82688097b300dd3f107c3e19c92662fba5359 (diff) |
f2fs: use strncasecmp() simplify the string comparison
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/namei.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 7e43f6829afd..2a5359c990fc 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -83,21 +83,11 @@ static int is_multimedia_file(const unsigned char *s, const char *sub) | |||
83 | { | 83 | { |
84 | size_t slen = strlen(s); | 84 | size_t slen = strlen(s); |
85 | size_t sublen = strlen(sub); | 85 | size_t sublen = strlen(sub); |
86 | int ret; | ||
87 | 86 | ||
88 | if (sublen > slen) | 87 | if (sublen > slen) |
89 | return 0; | 88 | return 0; |
90 | 89 | ||
91 | ret = memcmp(s + slen - sublen, sub, sublen); | 90 | return !strncasecmp(s + slen - sublen, sub, sublen); |
92 | if (ret) { /* compare upper case */ | ||
93 | int i; | ||
94 | char upper_sub[8]; | ||
95 | for (i = 0; i < sublen && i < sizeof(upper_sub); i++) | ||
96 | upper_sub[i] = toupper(sub[i]); | ||
97 | return !memcmp(s + slen - sublen, upper_sub, sublen); | ||
98 | } | ||
99 | |||
100 | return !ret; | ||
101 | } | 91 | } |
102 | 92 | ||
103 | /* | 93 | /* |