From: Volker Lendecke Date: Tue, 23 May 2023 08:44:40 +0000 (+0200) Subject: lib: Simplify two if-expressions X-Git-Tag: talloc-2.4.1~348 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b7fb13654fba3f3a06189e86dafb0c5e483b0ca;p=thirdparty%2Fsamba.git lib: Simplify two if-expressions This version looks easier to read to me. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/util.c b/source3/lib/util.c index 9fd913ba729..922b7ad83d9 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -119,11 +119,8 @@ uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf) bool check_same_dev_ino(const SMB_STRUCT_STAT *sbuf1, const SMB_STRUCT_STAT *sbuf2) { - if (sbuf1->st_ex_dev != sbuf2->st_ex_dev || - sbuf1->st_ex_ino != sbuf2->st_ex_ino) { - return false; - } - return true; + return ((sbuf1->st_ex_dev == sbuf2->st_ex_dev) && + (sbuf1->st_ex_ino == sbuf2->st_ex_ino)); } /**************************************************************************** @@ -131,14 +128,11 @@ bool check_same_dev_ino(const SMB_STRUCT_STAT *sbuf1, ****************************************************************************/ bool check_same_stat(const SMB_STRUCT_STAT *sbuf1, - const SMB_STRUCT_STAT *sbuf2) + const SMB_STRUCT_STAT *sbuf2) { - if (sbuf1->st_ex_uid != sbuf2->st_ex_uid || - sbuf1->st_ex_gid != sbuf2->st_ex_gid || - !check_same_dev_ino(sbuf1, sbuf2)) { - return false; - } - return true; + return ((sbuf1->st_ex_uid == sbuf2->st_ex_uid) && + (sbuf1->st_ex_gid == sbuf2->st_ex_gid) && + check_same_dev_ino(sbuf1, sbuf2)); } /*******************************************************************