]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_commit: Reduce indentation with early returns
authorVolker Lendecke <vl@samba.org>
Sun, 19 Oct 2025 09:33:03 +0000 (11:33 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 7 Jan 2026 09:57:41 +0000 (09:57 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/modules/vfs_commit.c

index a5d334c81bc801f04078c2fa2bad0529bd34c398..55d82abb10d2ad95f1c790730d79acff17a19b61 100644 (file)
@@ -105,18 +105,17 @@ static int commit_all(
         struct vfs_handle_struct *     handle,
         files_struct *                 fsp)
 {
-        struct commit_info *c;
+       struct commit_info *c = VFS_FETCH_FSP_EXTENSION(handle, fsp);
 
-        if ((c = (struct commit_info *)VFS_FETCH_FSP_EXTENSION(handle, fsp))) {
-                if (c->dbytes) {
-                        DEBUG(module_debug,
-                                ("%s: flushing %zu dirty bytes\n",
-                                 MODULE, c->dbytes));
+       if ((c == NULL) || (c->dbytes == 0)) {
+               return 0;
+       }
 
-                        return commit_do(c, fsp_get_io_fd(fsp));
-                }
-        }
-        return 0;
+       DEBUG(module_debug,
+             ("%s: flushing %zu dirty bytes\n",
+              MODULE, c->dbytes));
+
+       return commit_do(c, fsp_get_io_fd(fsp));
 }
 
 static int commit(