From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBwcd-000824-Bw for qemu-devel@nongnu.org; Thu, 06 Oct 2011 18:41:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBwcc-0001hv-5h for qemu-devel@nongnu.org; Thu, 06 Oct 2011 18:40:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBwcb-0001hU-V3 for qemu-devel@nongnu.org; Thu, 06 Oct 2011 18:40:58 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p96Meuw2002083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Oct 2011 18:40:56 -0400 From: Juan Quintela In-Reply-To: <4E8DD6A7.7050404@redhat.com> (Paolo Bonzini's message of "Thu, 06 Oct 2011 18:26:15 +0200") References: <49696d43bab6d485d414cfe58772c9ac54926b63.1317911543.git.quintela@redhat.com> <4E8DD6A7.7050404@redhat.com> Date: Fri, 07 Oct 2011 00:40:49 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 3/5] savevm: define qemu_get_byte() using qemu_peek_byte() Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org Paolo Bonzini wrote: > On 10/06/2011 06:21 PM, Juan Quintela wrote: >> + result = qemu_peek_byte(f); >> + >> + if (f->buf_index< f->buf_size) { >> + f->buf_index++; >> } > > This should really be an assert that f->buf_index < f->buf_size, > otherwise qemu_peek_byte has read garbage. That is a change from current behaviour. qemu_get_byte() returns 0 in the case that there is nothing to read. Yes, it is ugly. Later, Juan.