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> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6523 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
244ab90e17
commit
be959463af
6
cutils.c
6
cutils.c
@ -129,6 +129,12 @@ void qemu_iovec_destroy(QEMUIOVector *qiov)
|
||||
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;
|
||||
|
@ -201,6 +201,7 @@ typedef struct QEMUIOVector {
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user