aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen.5i5j@gmail.com>2014-05-10 20:51:24 +0800
committerJuan Quintela <quintela@trasno.org>2014-05-14 15:24:51 +0200
commitfb626663da94ddbfae88900c62bf4a26534fbafa (patch)
tree515e95e955c378dc540562e7c760a26255c63eb6 /arch_init.c
parentf30d56e7d63fe2f536511bffa13306bec2e01c37 (diff)
downloadqemu-fb626663da94ddbfae88900c62bf4a26534fbafa.zip
qemu-fb626663da94ddbfae88900c62bf4a26534fbafa.tar.gz
qemu-fb626663da94ddbfae88900c62bf4a26534fbafa.tar.bz2
arch_init: Simplify code for load_xbzrle()
For xbzrle_decode_buffer(), when decoding contents will exceed writing buffer, it will return -1, so need not check the return value whether large than writing buffer. And when failure occurs within load_xbzrle(), it always return -1 without any resources which need release. So can remove the related checking statements, and also can remove 'rc' and 'ret' local variables, Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/arch_init.c b/arch_init.c
index 995f56d..4e8f2c8 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -946,7 +946,6 @@ static uint64_t ram_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
{
- int ret, rc = 0;
unsigned int xh_len;
int xh_flags;
@@ -971,18 +970,13 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
qemu_get_buffer(f, xbzrle_decoded_buf, xh_len);
/* decode RLE */
- ret = xbzrle_decode_buffer(xbzrle_decoded_buf, xh_len, host,
- TARGET_PAGE_SIZE);
- if (ret == -1) {
+ if (xbzrle_decode_buffer(xbzrle_decoded_buf, xh_len, host,
+ TARGET_PAGE_SIZE) == -1) {
fprintf(stderr, "Failed to load XBZRLE page - decode error!\n");
- rc = -1;
- } else if (ret > TARGET_PAGE_SIZE) {
- fprintf(stderr, "Failed to load XBZRLE page - size %d exceeds %d!\n",
- ret, TARGET_PAGE_SIZE);
- abort();
+ return -1;
}
- return rc;
+ return 0;
}
static inline void *host_from_stream_offset(QEMUFile *f,