[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/41] migration: simplify while loop
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 01/41] migration: simplify while loop |
Date: |
Fri, 15 Feb 2013 18:46:33 +0100 |
Unify the goto around the loop, with the exit condition at the end of it.
Both can be expressed as "while (ret >= 0)".
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/migration.c b/migration.c
index b1ebb01..5414060 100644
--- a/migration.c
+++ b/migration.c
@@ -665,14 +665,9 @@ static void *buffered_file_thread(void *opaque)
qemu_mutex_lock_iothread();
DPRINTF("beginning savevm\n");
ret = qemu_savevm_state_begin(s->file, &s->params);
- if (ret < 0) {
- DPRINTF("failed, %d\n", ret);
- qemu_mutex_unlock_iothread();
- goto out;
- }
qemu_mutex_unlock_iothread();
- while (true) {
+ while (ret >= 0) {
int64_t current_time = qemu_get_clock_ms(rt_clock);
uint64_t pending_size;
@@ -745,12 +740,8 @@ static void *buffered_file_thread(void *opaque)
g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
}
ret = buffered_flush(s);
- if (ret < 0) {
- break;
- }
}
-out:
if (ret < 0) {
migrate_fd_error(s);
}
--
1.7.1