Commit 790bbb97 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Thomas Huth
Browse files

tests: use g_new() family of functions



Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: split of some files in other commits of the same series, add libqtest.c]
Acked-by: default avatarJohn Snow <jsnow@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
parent d3c92188
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ static AHCIQState *ahci_vboot(const char *cli, va_list ap)
{
    AHCIQState *s;

    s = g_malloc0(sizeof(AHCIQState));
    s = g_new0(AHCIQState, 1);
    s->parent = qtest_pc_vboot(cli, ap);
    alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);

@@ -1806,7 +1806,7 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
    char *name;
    AHCIIOTestOptions *opts;

    opts = g_malloc(sizeof(AHCIIOTestOptions));
    opts = g_new(AHCIIOTestOptions, 1);
    opts->length = len;
    opts->address_type = addr;
    opts->io_type = type;
+2 −2
Original line number Diff line number Diff line
@@ -79,8 +79,8 @@ static void test_fw_cfg_numa(void)

    g_assert_cmpint(qfw_cfg_get_u64(fw_cfg, FW_CFG_NUMA), ==, nb_nodes);

    cpu_mask = g_malloc0(sizeof(uint64_t) * max_cpus);
    node_mask = g_malloc0(sizeof(uint64_t) * nb_nodes);
    cpu_mask = g_new0(uint64_t, max_cpus);
    node_mask = g_new0(uint64_t, nb_nodes);

    qfw_cfg_read_data(fw_cfg, cpu_mask, sizeof(uint64_t) * max_cpus);
    qfw_cfg_read_data(fw_cfg, node_mask, sizeof(uint64_t) * nb_nodes);
+1 −1
Original line number Diff line number Diff line
@@ -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));
+1 −1
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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);

Loading