lkml.org 
[lkml]   [2022]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH -next v2 2/2] fs/ntfs3: Eliminate unnecessary ternary operator in ntfs_d_compare()
On Tue, Oct 4, 2022 at 4:24 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 'a == b ? 0 : 1' is logically equivalent to 'a != b'.
>
> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>
> v2: New patch.
>
> fs/ntfs3/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
> index 5d3a6ce3f05f..6b0d2c01d6ff 100644
> --- a/fs/ntfs3/namei.c
> +++ b/fs/ntfs3/namei.c
> @@ -432,7 +432,7 @@ static int ntfs_d_compare(const struct dentry *dentry, unsigned int len1,
> /* First try fast implementation. */
> for (;;) {
> if (!lm--)
> - return len1 == len2 ? 0 : 1;
> + return len1 != len2;
>
> if ((c1 = *n1++) == (c2 = *n2++))
> continue;
> --
> 2.37.3
>


--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2022-10-05 01:26    [W:0.063 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site