]> git.proxmox.com Git - mirror_qemu.git/commitdiff
test-iov: replace g_malloc()+memcpy() with g_memdup()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 6 Jun 2017 20:45:43 +0000 (00:45 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 31 Aug 2017 10:29:07 +0000 (12:29 +0200)
I found these pattern via grepping the source tree. I don't have a
coccinelle script for it!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
tests/test-iov.c

index a22d71fd2c57c9f15a0c573b422ff9f62db49466..fa3d75aee1b299d10a84ec8d3140d81e2c3cee53 100644 (file)
@@ -167,8 +167,7 @@ static void test_io(void)
     }
     iov_from_buf(iov, niov, 0, buf, sz);
 
-    siov = g_malloc(sizeof(*iov) * niov);
-    memcpy(siov, iov, sizeof(*iov) * niov);
+    siov = g_memdup(iov, sizeof(*iov) * niov);
 
     if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) {
        perror("socketpair");