qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6523] Add qemu_iovec_reset() (Avi Kivity)
Date: Thu, 05 Feb 2009 21:23:54 +0000	[thread overview]
Message-ID: <E1LVBhS-0005rR-OO@cvs.savannah.gnu.org> (raw)

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 <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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);
 

                 reply	other threads:[~2009-02-05 21:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1LVBhS-0005rR-OO@cvs.savannah.gnu.org \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).