aboutsummaryrefslogtreecommitdiff
path: root/savevm.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2011-10-06 14:29:32 +0200
committerJuan Quintela <quintela@redhat.com>2011-10-20 13:23:11 +0200
commit65f3bb3da3d5b46daebbfc54bd41ee493fdaba86 (patch)
tree8ebac064f44fd69e366fd571e6bb469b4dbd49db /savevm.c
parentb9ce1454e14ec918acb90d899ce7724f69682f45 (diff)
savevm: define qemu_get_byte() using qemu_peek_byte()
Signed-off-by: Juan Quintela<quintela@redhat.com>
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/savevm.c b/savevm.c
index 6e4bb3a3df..038099979e 100644
--- a/savevm.c
+++ b/savevm.c
@@ -578,17 +578,14 @@ static int qemu_peek_byte(QEMUFile *f)
int qemu_get_byte(QEMUFile *f)
{
- if (f->is_write) {
- abort();
- }
+ int result;
- if (f->buf_index >= f->buf_size) {
- qemu_fill_buffer(f);
- if (f->buf_index >= f->buf_size) {
- return 0;
- }
+ result = qemu_peek_byte(f);
+
+ if (f->buf_index < f->buf_size) {
+ f->buf_index++;
}
- return f->buf[f->buf_index++];
+ return result;
}
int64_t qemu_ftell(QEMUFile *f)