summaryrefslogtreecommitdiff
path: root/tests/libqos
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-10-06 20:49:56 -0300
committerThomas Huth <thuth@redhat.com>2017-10-16 13:29:49 +0200
commit790bbb9768e6a21920e76989f931db80ca67dc10 (patch)
tree0fc32564560acb9210742fb2a5fa947b8f7d5fb7 /tests/libqos
parentd3c9218840c070f1c81ac20bc02fb6aafc6e3803 (diff)
downloadqemu-790bbb9768e6a21920e76989f931db80ca67dc10.tar.gz
tests: use g_new() family of functions
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [PMD: split of some files in other commits of the same series, add libqtest.c] Acked-by: John Snow <jsnow@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/libqos')
-rw-r--r--tests/libqos/ahci.c2
-rw-r--r--tests/libqos/libqos.c2
-rw-r--r--tests/libqos/malloc.c6
3 files changed, 5 insertions, 5 deletions
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 1ca7f456b5..13c0749582 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -843,7 +843,7 @@ AHCICommand *ahci_command_create(uint8_t command_name)
AHCICommand *cmd;
g_assert(props);
- cmd = g_malloc0(sizeof(AHCICommand));
+ cmd = g_new0(AHCICommand, 1);
g_assert(!(props->dma && props->pio));
g_assert(!(props->lba28 && props->lba48));
g_assert(!(props->read && props->write));
diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
index 6226546c28..991bc1aec2 100644
--- a/tests/libqos/libqos.c
+++ b/tests/libqos/libqos.c
@@ -17,7 +17,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)
{
char *cmdline;
- struct QOSState *qs = g_malloc(sizeof(QOSState));
+ struct QOSState *qs = g_new(QOSState, 1);
cmdline = g_strdup_vprintf(cmdline_fmt, ap);
qs->qts = qtest_start(cmdline);
diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index b8eff5f495..ac05874b0a 100644
--- a/tests/libqos/malloc.c
+++ b/tests/libqos/malloc.c
@@ -129,7 +129,7 @@ static MemBlock *mlist_new(uint64_t addr, uint64_t size)
if (!size) {
return NULL;
}
- block = g_malloc0(sizeof(MemBlock));
+ block = g_new0(MemBlock, 1);
block->addr = addr;
block->size = size;
@@ -305,8 +305,8 @@ QGuestAllocator *alloc_init(uint64_t start, uint64_t end)
s->start = start;
s->end = end;
- s->used = g_malloc(sizeof(MemList));
- s->free = g_malloc(sizeof(MemList));
+ s->used = g_new(MemList, 1);
+ s->free = g_new(MemList, 1);
QTAILQ_INIT(s->used);
QTAILQ_INIT(s->free);