* [PATCH] f2fs: use strncasecmp() simplify the string comparison
@ 2013-08-22 10:11 Gu Zheng
0 siblings, 0 replies; only message in thread
From: Gu Zheng @ 2013-08-22 10:11 UTC (permalink / raw)
To: Kim; +Cc: f2fs, linux-kernel, fsdevel
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
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 4e47518..106c0b4 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)
{
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);
}
/*
--
1.7.7
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-22 10:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 10:11 [PATCH] f2fs: use strncasecmp() simplify the string comparison Gu Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).