tests: use g_new0 instead of VIR_ALLOC

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Ján Tomko 2020-10-08 13:49:50 +02:00
parent a80a81be65
commit 173e2e73bf

View File

@ -117,8 +117,7 @@ testReallocArray(const void *opaque G_GNUC_UNUSED)
size_t nt = 10, i; size_t nt = 10, i;
int ret = -1; int ret = -1;
if (VIR_ALLOC_N(t, nt) < 0) t = g_new0(testDummyStruct, nt);
return -1;
if (testCheckNonNull(t) < 0) if (testCheckNonNull(t) < 0)
goto cleanup; goto cleanup;
@ -191,8 +190,7 @@ testExpandArray(const void *opaque G_GNUC_UNUSED)
size_t nt = 10, i; size_t nt = 10, i;
int ret = -1; int ret = -1;
if (VIR_ALLOC_N(t, nt) < 0) t = g_new0(testDummyStruct, nt);
return -1;
if (testCheckNonNull(t) < 0) if (testCheckNonNull(t) < 0)
goto cleanup; goto cleanup;
@ -271,8 +269,7 @@ testResizeArray(const void *opaque G_GNUC_UNUSED)
size_t nt = 10, at, i; size_t nt = 10, at, i;
int ret = -1; int ret = -1;
if (VIR_ALLOC_N(t, nt) < 0) t = g_new0(testDummyStruct, nt);
return -1;
at = nt; at = nt;
@ -333,8 +330,7 @@ testInsertArray(const void *opaque G_GNUC_UNUSED)
int ret = -1; int ret = -1;
testDummyStruct *n = (void *)0xff; testDummyStruct *n = (void *)0xff;
if (VIR_ALLOC_N(t, nt) < 0) t = g_new0(testDummyStruct, nt);
return -1;
if (testCheckNonNull(t) < 0) if (testCheckNonNull(t) < 0)
goto cleanup; goto cleanup;
@ -398,14 +394,12 @@ testDispose(const void *opaque G_GNUC_UNUSED)
nnums = 10; nnums = 10;
VIR_DISPOSE_N(nums, nnums); VIR_DISPOSE_N(nums, nnums);
if (VIR_ALLOC(num) < 0) num = g_new0(int, 1);
return -1;
VIR_DISPOSE(num); VIR_DISPOSE(num);
nnums = 10; nnums = 10;
if (VIR_ALLOC_N(nums, nnums) < 0) nums = g_new0(int, nnums);
return -1;
VIR_DISPOSE_N(nums, nnums); VIR_DISPOSE_N(nums, nnums);