aboutsummaryrefslogtreecommitdiffstats
path: root/savevm.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2011-10-04 13:55:32 +0200
committerJuan Quintela <quintela@redhat.com>2011-10-20 13:23:11 +0200
commitb9ce1454e14ec918acb90d899ce7724f69682f45 (patch)
tree6a1bdcf9e1bbaffec7e9defbd423f9cbff3f6fd0 /savevm.c
parent0046c45bc1c70b5b985822f8639bb718f6d535a5 (diff)
savevm: some coding style cleanups
This patch will make moving code on next patches and having checkpatch happy easier. Signed-off-by: Juan Quintela<quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/savevm.c b/savevm.c
index aa6fef08a..6e4bb3a3d 100644
--- a/savevm.c
+++ b/savevm.c
@@ -536,8 +536,9 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
{
int size, l;
- if (f->is_write)
+ if (f->is_write) {
abort();
+ }
size = size1;
while (size > 0) {
@@ -545,11 +546,13 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
if (l == 0) {
qemu_fill_buffer(f);
l = f->buf_size - f->buf_index;
- if (l == 0)
+ if (l == 0) {
break;
+ }
}
- if (l > size)
+ if (l > size) {
l = size;
+ }
memcpy(buf, f->buf + f->buf_index, l);
f->buf_index += l;
buf += l;
@@ -560,26 +563,30 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
static int qemu_peek_byte(QEMUFile *f)
{
- if (f->is_write)
+ if (f->is_write) {
abort();
+ }
if (f->buf_index >= f->buf_size) {
qemu_fill_buffer(f);
- if (f->buf_index >= f->buf_size)
+ if (f->buf_index >= f->buf_size) {
return 0;
+ }
}
return f->buf[f->buf_index];
}
int qemu_get_byte(QEMUFile *f)
{
- if (f->is_write)
+ if (f->is_write) {
abort();
+ }
if (f->buf_index >= f->buf_size) {
qemu_fill_buffer(f);
- if (f->buf_index >= f->buf_size)
+ if (f->buf_index >= f->buf_size) {
return 0;
+ }
}
return f->buf[f->buf_index++];
}