On Thu, 2010-06-24 at 07:51 +0200, Paolo Bonzini wrote: > > @@ -377,26 +398,11 @@ int ram_load(QEMUFile *f, void *opaque, int > > version_id) > > } else if (flags& RAM_SAVE_FLAG_PAGE) { > > void *host; > > > > - if (version_id == 3) { > > + if (version_id == 3) > > host = qemu_get_ram_ptr(addr); > > - } else { > > - RAMBlock *block; > > - char id[256]; > > - uint8_t len; > > + else > > + host = host_from_stream_offset(f, addr, flags); > > > > - len = qemu_get_byte(f); > > - qemu_get_buffer(f, (uint8_t *)id, len); > > - id[len] = 0; > > - > > - QLIST_FOREACH(block,&ram_list.blocks, next) { > > - if (!strncmp(id, block->idstr, sizeof(id))) > > - break; > > - } > > - if (!block) > > - return -EINVAL; > > - > > - host = block->host + addr; > > - } > > qemu_get_buffer(f, host, TARGET_PAGE_SIZE); > > } > > if (qemu_file_has_error(f)) { > > Gah, sorry. :) > > This also takes care of the code duplication, great.
It was certainly a good thought ;) See my reply to Yoshi for the overhead saved. Thanks, Alex