From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVBhX-0007fR-1K for qemu-devel@nongnu.org; Thu, 05 Feb 2009 16:23:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVBhV-0007eT-Th for qemu-devel@nongnu.org; Thu, 05 Feb 2009 16:23:58 -0500 Received: from [199.232.76.173] (port=38246 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVBhV-0007eG-76 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 16:23:57 -0500 Received: from savannah.gnu.org ([199.232.41.3]:43307 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LVBhU-0005UU-JR for qemu-devel@nongnu.org; Thu, 05 Feb 2009 16:23:56 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LVBhT-0005rV-75 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 21:23:55 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LVBhS-0005rR-OO for qemu-devel@nongnu.org; Thu, 05 Feb 2009 21:23:55 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 05 Feb 2009 21:23:54 +0000 Subject: [Qemu-devel] [6523] Add qemu_iovec_reset() (Avi Kivity) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6523 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6523 Author: aliguori Date: 2009-02-05 21:23:54 +0000 (Thu, 05 Feb 2009) Log Message: ----------- Add qemu_iovec_reset() (Avi Kivity) Add a helper to zero out an existing iovec. Removes the need to deallocate and reallocate it. Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/cutils.c trunk/qemu-common.h Modified: trunk/cutils.c =================================================================== --- trunk/cutils.c 2009-02-05 21:23:50 UTC (rev 6522) +++ trunk/cutils.c 2009-02-05 21:23:54 UTC (rev 6523) @@ -129,6 +129,12 @@ qemu_free(qiov->iov); } +void qemu_iovec_reset(QEMUIOVector *qiov) +{ + qiov->niov = 0; + qiov->size = 0; +} + void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf) { uint8_t *p = (uint8_t *)buf; Modified: trunk/qemu-common.h =================================================================== --- trunk/qemu-common.h 2009-02-05 21:23:50 UTC (rev 6522) +++ trunk/qemu-common.h 2009-02-05 21:23:54 UTC (rev 6523) @@ -201,6 +201,7 @@ void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint); void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len); void qemu_iovec_destroy(QEMUIOVector *qiov); +void qemu_iovec_reset(QEMUIOVector *qiov); void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf); void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count);