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>
This commit is contained in:
Juan Quintela 2011-10-04 13:55:32 +02:00
parent 0046c45bc1
commit b9ce1454e1
1 changed files with 14 additions and 7 deletions

View File

@ -536,8 +536,9 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
{ {
int size, l; int size, l;
if (f->is_write) if (f->is_write) {
abort(); abort();
}
size = size1; size = size1;
while (size > 0) { while (size > 0) {
@ -545,11 +546,13 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
if (l == 0) { if (l == 0) {
qemu_fill_buffer(f); qemu_fill_buffer(f);
l = f->buf_size - f->buf_index; l = f->buf_size - f->buf_index;
if (l == 0) if (l == 0) {
break; break;
} }
if (l > size) }
if (l > size) {
l = size; l = size;
}
memcpy(buf, f->buf + f->buf_index, l); memcpy(buf, f->buf + f->buf_index, l);
f->buf_index += l; f->buf_index += l;
buf += l; buf += l;
@ -560,27 +563,31 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
static int qemu_peek_byte(QEMUFile *f) static int qemu_peek_byte(QEMUFile *f)
{ {
if (f->is_write) if (f->is_write) {
abort(); abort();
}
if (f->buf_index >= f->buf_size) { if (f->buf_index >= f->buf_size) {
qemu_fill_buffer(f); qemu_fill_buffer(f);
if (f->buf_index >= f->buf_size) if (f->buf_index >= f->buf_size) {
return 0; return 0;
} }
}
return f->buf[f->buf_index]; return f->buf[f->buf_index];
} }
int qemu_get_byte(QEMUFile *f) int qemu_get_byte(QEMUFile *f)
{ {
if (f->is_write) if (f->is_write) {
abort(); abort();
}
if (f->buf_index >= f->buf_size) { if (f->buf_index >= f->buf_size) {
qemu_fill_buffer(f); qemu_fill_buffer(f);
if (f->buf_index >= f->buf_size) if (f->buf_index >= f->buf_size) {
return 0; return 0;
} }
}
return f->buf[f->buf_index++]; return f->buf[f->buf_index++];
} }