From 94666c70ce586deb06429f1e1d75a69302ca2e75 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Sun, 9 Oct 2011 19:32:07 +0200 Subject: [PATCH 3/8] savevm: some coding style cleanups RH-Author: Juan Quintela Message-id: Patchwork-id: 33951 O-Subject: [PATCH 2/5] savevm: some coding style cleanups Bugzilla: 725565 RH-Acked-by: Orit Wasserman RH-Acked-by: Paolo Bonzini RH-Acked-by: Alex Williamson This patch will make moving code on next patches and having checkpatch happy easier. Signed-off-by: Juan Quintela Reviewed-by: Anthony Liguori Signed-off-by: Juan Quintela --- savevm.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) Signed-off-by: Michal Novotny --- savevm.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/savevm.c b/savevm.c index 629bcad..a7e2c0d 100644 --- a/savevm.c +++ b/savevm.c @@ -539,8 +539,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) { @@ -548,11 +549,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; @@ -563,26 +566,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++]; } -- 1.7.4.4