Commit c0abbdf2 authored by Yangtao Li's avatar Yangtao Li Committed by Jaegeuk Kim

f2fs: convert is_extension_exist() to return bool type

is_extension_exist() only return two values, 0 or 1.
So there is no need to use int type.
Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 1aa161e4
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "acl.h" #include "acl.h"
#include <trace/events/f2fs.h> #include <trace/events/f2fs.h>
static inline int is_extension_exist(const unsigned char *s, const char *sub, static inline bool is_extension_exist(const unsigned char *s, const char *sub,
bool tmp_ext) bool tmp_ext)
{ {
size_t slen = strlen(s); size_t slen = strlen(s);
...@@ -30,19 +30,19 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub, ...@@ -30,19 +30,19 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub,
int i; int i;
if (sublen == 1 && *sub == '*') if (sublen == 1 && *sub == '*')
return 1; return true;
/* /*
* filename format of multimedia file should be defined as: * filename format of multimedia file should be defined as:
* "filename + '.' + extension + (optional: '.' + temp extension)". * "filename + '.' + extension + (optional: '.' + temp extension)".
*/ */
if (slen < sublen + 2) if (slen < sublen + 2)
return 0; return false;
if (!tmp_ext) { if (!tmp_ext) {
/* file has no temp extension */ /* file has no temp extension */
if (s[slen - sublen - 1] != '.') if (s[slen - sublen - 1] != '.')
return 0; return false;
return !strncasecmp(s + slen - sublen, sub, sublen); return !strncasecmp(s + slen - sublen, sub, sublen);
} }
...@@ -50,10 +50,10 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub, ...@@ -50,10 +50,10 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub,
if (s[i] != '.') if (s[i] != '.')
continue; continue;
if (!strncasecmp(s + i + 1, sub, sublen)) if (!strncasecmp(s + i + 1, sub, sublen))
return 1; return true;
} }
return 0; return false;
} }
int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment