linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: convert is_extension_exist() to return bool type
@ 2023-01-12 14:31 Yangtao Li via Linux-f2fs-devel
  2023-01-28 10:52 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2023-01-12 14:31 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel

is_extension_exist() only return two values, 0 or 1.
So there is no need to use int type.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/namei.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 6032589099ce..516968cbc6d6 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -22,7 +22,7 @@
 #include "acl.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)
 {
 	size_t slen = strlen(s);
@@ -30,19 +30,19 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub,
 	int i;
 
 	if (sublen == 1 && *sub == '*')
-		return 1;
+		return true;
 
 	/*
 	 * filename format of multimedia file should be defined as:
 	 * "filename + '.' + extension + (optional: '.' + temp extension)".
 	 */
 	if (slen < sublen + 2)
-		return 0;
+		return false;
 
 	if (!tmp_ext) {
 		/* file has no temp extension */
 		if (s[slen - sublen - 1] != '.')
-			return 0;
+			return false;
 		return !strncasecmp(s + slen - sublen, sub, sublen);
 	}
 
@@ -50,10 +50,10 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub,
 		if (s[i] != '.')
 			continue;
 		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,
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: convert is_extension_exist() to return bool type
  2023-01-12 14:31 [f2fs-dev] [PATCH] f2fs: convert is_extension_exist() to return bool type Yangtao Li via Linux-f2fs-devel
@ 2023-01-28 10:52 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2023-01-28 10:52 UTC (permalink / raw)
  To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

On 2023/1/12 22:31, Yangtao Li wrote:
> is_extension_exist() only return two values, 0 or 1.
> So there is no need to use int type.

It's too trivial to do such change one by one, how about merging all
similar changes into one patch?

Thanks,

> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>   fs/f2fs/namei.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 6032589099ce..516968cbc6d6 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -22,7 +22,7 @@
>   #include "acl.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)
>   {
>   	size_t slen = strlen(s);
> @@ -30,19 +30,19 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub,
>   	int i;
>   
>   	if (sublen == 1 && *sub == '*')
> -		return 1;
> +		return true;
>   
>   	/*
>   	 * filename format of multimedia file should be defined as:
>   	 * "filename + '.' + extension + (optional: '.' + temp extension)".
>   	 */
>   	if (slen < sublen + 2)
> -		return 0;
> +		return false;
>   
>   	if (!tmp_ext) {
>   		/* file has no temp extension */
>   		if (s[slen - sublen - 1] != '.')
> -			return 0;
> +			return false;
>   		return !strncasecmp(s + slen - sublen, sub, sublen);
>   	}
>   
> @@ -50,10 +50,10 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub,
>   		if (s[i] != '.')
>   			continue;
>   		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,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-28 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 14:31 [f2fs-dev] [PATCH] f2fs: convert is_extension_exist() to return bool type Yangtao Li via Linux-f2fs-devel
2023-01-28 10:52 ` Chao Yu

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).