Reduce the number of indentation levels in suspend_system().

---
 suspend.c |   70 ++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 34 insertions(+), 36 deletions(-)

Index: suspend/suspend.c
===================================================================
--- suspend.orig/suspend.c      2007-08-16 15:09:26.000000000 +0200
+++ suspend/suspend.c   2007-08-16 15:17:08.000000000 +0200
@@ -823,47 +823,45 @@ int suspend_system(int snapshot_fd, int 
                        error = errno;
                        break;
                }
-               if (!atomic_snapshot(snapshot_fd, &in_suspend)) {
-                       if (!in_suspend) {
-                               /* first unblank the console, see 
console_codes(4) */
-                               printf("\e[13]");
-                               printf("%s: returned to userspace\n", my_name);
-                               free_snapshot(snapshot_fd);
+               if (atomic_snapshot(snapshot_fd, &in_suspend)) {
+                       error = errno;
+                       break;
+               }
+               if (!in_suspend) {
+                       /* first unblank the console, see console_codes(4) */
+                       printf("\e[13]");
+                       printf("%s: returned to userspace\n", my_name);
+                       free_snapshot(snapshot_fd);
+                       break;
+               }
+
+               error = write_image(snapshot_fd, resume_fd);
+               if (error) {
+                       free_swap_pages(snapshot_fd);
+                       free_snapshot(snapshot_fd);
+                       image_size = 0;
+                       error = -error;
+                       if (error != ENOSPC)
                                break;
-                       }
-                       error = write_image(snapshot_fd, resume_fd);
-                       if (!error) {
-                               splash.progress(100);
+               } else {
+                       splash.progress(100);
 #ifdef CONFIG_BOTH
-                               if (!s2ram) {
-                                       suspend_shutdown(snapshot_fd);
-                               } else {
-                                       /* If we die (and allow system to 
continue) between
-                                         * now and reset_signature(), very bad 
things will
-                                         * happen. */
-                                       error = suspend_to_ram(snapshot_fd);
-                                       if (error)
-                                               suspend_shutdown(snapshot_fd);
-                                       reset_signature(resume_fd);
-                                       free_swap_pages(snapshot_fd);
-                                       free_snapshot(snapshot_fd);
-                                       s2ram_resume();
-                                       goto Unfreeze;
-                               }
-#else
-                               suspend_shutdown(snapshot_fd);
-#endif
-                       } else {
+                       if (s2ram) {
+                               /* If we die (and allow system to continue)
+                                * between now and reset_signature(), very bad
+                                * things will happen. */
+                               error = suspend_to_ram(snapshot_fd);
+                               if (error)
+                                       goto Shutdown;
+                               reset_signature(resume_fd);
                                free_swap_pages(snapshot_fd);
                                free_snapshot(snapshot_fd);
-                               image_size = 0;
-                               error = -error;
-                               if (error != ENOSPC)
-                                       break;
+                               s2ram_resume();
+                               goto Unfreeze;
                        }
-               } else {
-                       error = errno;
-                       break;
+Shutdown:
+#endif
+                       suspend_shutdown(snapshot_fd);
                }
        } while (--attempts);
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to