Two if/return-true blocks followed by a final return false
are equivalent to a single OR-expression and easier to scan.

Signed-off-by: Bin Guo <[email protected]>
---
 migration/fd.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/migration/fd.c b/migration/fd.c
index f05f95992f..939cdda4e1 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -39,15 +39,7 @@ static bool fd_is_pipe(int fd)
 
 static bool migration_fd_valid(int fd)
 {
-    if (fd_is_socket(fd)) {
-        return true;
-    }
-
-    if (fd_is_pipe(fd)) {
-        return true;
-    }
-
-    return false;
+    return fd_is_socket(fd) || fd_is_pipe(fd);
 }
 
 QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname,
-- 
2.50.1 (Apple Git-155)


Reply via email to