From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4VIB-0008Td-2a for qemu-devel@nongnu.org; Wed, 21 Apr 2010 04:28:19 -0400 Received: from [140.186.70.92] (port=45442 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4VI7-0008Rv-4l for qemu-devel@nongnu.org; Wed, 21 Apr 2010 04:28:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4VHt-0007SJ-1Q for qemu-devel@nongnu.org; Wed, 21 Apr 2010 04:28:14 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:55935) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4VHs-0007S5-Ue for qemu-devel@nongnu.org; Wed, 21 Apr 2010 04:28:01 -0400 Received: by gwj16 with SMTP id 16so1715702gwj.4 for ; Wed, 21 Apr 2010 01:27:59 -0700 (PDT) MIME-Version: 1.0 Sender: tamura.yoshiaki@gmail.com In-Reply-To: References: <1271829445-5328-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <1271829445-5328-5-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> Date: Wed, 21 Apr 2010 17:27:59 +0900 Message-ID: From: Yoshiaki Tamura Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [RFC PATCH 04/20] Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and qemu_clear_buffer(). List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: ohmura.kei@lab.ntt.co.jp, kvm@vger.kernel.org, mtosatti@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, yoshikawa.takuya@oss.ntt.co.jp, avi@redhat.com 2010/4/21 Stefan Hajnoczi : > On Wed, Apr 21, 2010 at 6:57 AM, Yoshiaki Tamura > wrote: >> @@ -454,6 +458,25 @@ void qemu_fflush(QEMUFile *f) >> =A0 =A0 } >> =A0} >> >> +void *qemu_realloc_buffer(QEMUFile *f, int size) >> +{ >> + =A0 =A0f->buf_max_size =3D size; >> + >> + =A0 =A0f->buf =3D qemu_realloc(f->buf, f->buf_max_size); >> + =A0 =A0if (f->buf =3D=3D NULL) { >> + =A0 =A0 =A0 =A0fprintf(stderr, "qemu file buffer realloc failed\n"); >> + =A0 =A0 =A0 =A0exit(1); >> + =A0 =A0} >> + >> + =A0 =A0return f->buf; >> +} >> + > > qemu_realloc() will abort() if there was not enough memory to realloc. > =A0Just like qemu_malloc(), you don't need to check for NULL. Thanks for your comment. I'll remove it. If there is no objection, I would like to take out this patch from the seri= es, and post it by itself. Yoshi > > Stefan > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at =A0http://vger.kernel.org/majordomo-info.html >