]> Git Repo - qemu.git/commit
util/iov: add iov_discard_undo()
authorStefan Hajnoczi <[email protected]>
Thu, 17 Sep 2020 09:44:53 +0000 (10:44 +0100)
committerStefan Hajnoczi <[email protected]>
Wed, 23 Sep 2020 12:41:58 +0000 (13:41 +0100)
commit9dd6f7c28eaa7d001a526d51c74bbf89d5402b8c
tree5ce0c2924bf4607bbdbc892eb806b37971c52dff
parentbd0bbb9aba2afbc2ea24b0475be04f795468b381
util/iov: add iov_discard_undo()

The iov_discard_front/back() operations are useful for parsing iovecs
but they modify the array elements. If the original array is needed
after parsing finishes there is currently no way to restore it.

Although g_memdup() can be used before performing destructive
iov_discard_front/back() operations, this is inefficient.

Introduce iov_discard_undo() to restore the array to the state prior to
an iov_discard_front/back() operation.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Li Qiang <[email protected]>
Message-Id: <20200917094455[email protected]>
include/qemu/iov.h
tests/test-iov.c
util/iov.c
This page took 0.025796 seconds and 4 git commands to generate.