[libvirt PATCH 5/7] src: libvirt-stream: use g_new0 instead of VIR_ALLOC*

Ján Tomko posted 7 patches 5 years, 4 months ago
[libvirt PATCH 5/7] src: libvirt-stream: use g_new0 instead of VIR_ALLOC*
Posted by Ján Tomko 5 years, 4 months ago
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/libvirt-stream.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
index aeb7562018..873d7b1d4e 100644
--- a/src/libvirt-stream.c
+++ b/src/libvirt-stream.c
@@ -588,8 +588,7 @@ virStreamSendAll(virStreamPtr stream,
         goto cleanup;
     }
 
-    if (VIR_ALLOC_N(bytes, want) < 0)
-        goto cleanup;
+    bytes = g_new0(char, want);
 
     errno = 0;
     for (;;) {
@@ -724,8 +723,7 @@ int virStreamSparseSendAll(virStreamPtr stream,
         goto cleanup;
     }
 
-    if (VIR_ALLOC_N(bytes, bufLen) < 0)
-        goto cleanup;
+    bytes = g_new0(char, bufLen);
 
     errno = 0;
     for (;;) {
@@ -859,8 +857,7 @@ virStreamRecvAll(virStreamPtr stream,
     }
 
 
-    if (VIR_ALLOC_N(bytes, want) < 0)
-        goto cleanup;
+    bytes = g_new0(char, want);
 
     errno = 0;
     for (;;) {
@@ -977,8 +974,7 @@ virStreamSparseRecvAll(virStreamPtr stream,
         goto cleanup;
     }
 
-    if (VIR_ALLOC_N(bytes, want) < 0)
-        goto cleanup;
+    bytes = g_new0(char, want);
 
     errno = 0;
     for (;;) {
-- 
2.26.2

Re: [libvirt PATCH 5/7] src: libvirt-stream: use g_new0 instead of VIR_ALLOC*
Posted by Peter Krempa 5 years, 4 months ago
On Fri, Sep 25, 2020 at 15:16:11 +0200, Ján Tomko wrote:
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/libvirt-stream.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>