Reduce the number of indentation levels in save_image().
---
suspend.c | 54 ++++++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 26 deletions(-)
Index: suspend/suspend.c
===================================================================
--- suspend.orig/suspend.c 2007-08-16 15:33:48.000000000 +0200
+++ suspend/suspend.c 2007-08-16 15:39:58.000000000 +0200
@@ -494,38 +494,40 @@ static int save_image(struct swap_map_ha
else
writeout_rate = nr_pages;
- nr_pages = 0;
- do {
+ for (nr_pages = 0; ; nr_pages++) {
ret = read(handle->dev, handle->page_buffer, page_size);
- if (ret > 0) {
- error = swap_write_page(handle);
- if (error)
- break;
+ if (ret <= 0)
+ break;
+
+ error = swap_write_page(handle);
+ if (error)
+ break;
- if (!(nr_pages % m)) {
- printf("\b\b\b\b%3d%%", nr_pages / m);
- splash.progress(20 + (nr_pages / m) * 0.75);
-
- switch (splash.key_pressed()) {
- case ABORT_KEY_CODE:
- if (abort_possible) {
- printf(" aborted!\n");
- error = -EINTR;
- goto Exit;
- }
+ if (!(nr_pages % m)) {
+ printf("\b\b\b\b%3d%%", nr_pages / m);
+ splash.progress(20 + (nr_pages / m) * 0.75);
+
+ switch (splash.key_pressed()) {
+ case ABORT_KEY_CODE:
+ if (abort_possible) {
+ printf(" aborted!\n");
+ error = -EINTR;
+ goto Exit;
+ }
break;
- case REBOOT_KEY_CODE:
- printf (" reboot
enabled\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
- shutdown_method =
SHUTDOWN_METHOD_REBOOT;
+ case REBOOT_KEY_CODE:
+ printf (" reboot enabled\b\b\b\b\b\b\b"
+ "\b\b\b\b\b\b\b\b");
+ shutdown_method =
+ SHUTDOWN_METHOD_REBOOT;
break;
- }
}
- if (!(nr_pages % writeout_rate))
- start_writeout(handle->fd);
-
- nr_pages++;
}
- } while (ret > 0);
+
+ if (!(nr_pages % writeout_rate))
+ start_writeout(handle->fd);
+ }
+
if (ret < 0)
error = -errno;
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel