[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/88] Migration: use g_new() family of functions
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 20/88] Migration: use g_new() family of functions |
Date: |
Fri, 6 Oct 2017 20:49:15 -0300 |
From: Marc-André Lureau <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
[PMD: indented, added migration/migration.c and migration/page_cache.c]
---
migration/migration.c | 2 +-
migration/page_cache.c | 2 +-
migration/postcopy-ram.c | 2 +-
migration/ram.c | 3 +--
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 98429dc843..4899182b32 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -485,7 +485,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error
**errp)
MigrationState *s = migrate_get_current();
/* TODO use QAPI_CLONE() instead of duplicating it inline */
- params = g_malloc0(sizeof(*params));
+ params = g_new0(MigrationParameters, 1);
params->has_compress_level = true;
params->compress_level = s->parameters.compress_level;
params->has_compress_threads = true;
diff --git a/migration/page_cache.c b/migration/page_cache.c
index ba984c4858..30169a1dd3 100644
--- a/migration/page_cache.c
+++ b/migration/page_cache.c
@@ -57,7 +57,7 @@ PageCache *cache_init(int64_t num_pages, unsigned int
page_size)
}
/* We prefer not to abort if there is no memory */
- cache = g_try_malloc(sizeof(*cache));
+ cache = g_try_new(PageCache, 1);
if (!cache) {
DPRINTF("Failed to allocate cache\n");
return NULL;
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 0de68e8b25..d51684ce30 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -811,7 +811,7 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis)
PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms,
const char *name)
{
- PostcopyDiscardState *res = g_malloc0(sizeof(PostcopyDiscardState));
+ PostcopyDiscardState *res = g_new0(PostcopyDiscardState, 1);
if (res) {
res->ramblock_name = name;
diff --git a/migration/ram.c b/migration/ram.c
index b83f8977c5..3f5407ee43 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1376,8 +1376,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t
start, ram_addr_t len)
goto err;
}
- struct RAMSrcPageRequest *new_entry =
- g_malloc0(sizeof(struct RAMSrcPageRequest));
+ struct RAMSrcPageRequest *new_entry = g_new0(struct RAMSrcPageRequest, 1);
new_entry->rb = ramblock;
new_entry->offset = start;
new_entry->len = len;
--
2.14.2
- [Qemu-devel] [PATCH 11/88] Cryptodev Backends: use g_new() family of functions, (continued)
- [Qemu-devel] [PATCH 11/88] Cryptodev Backends: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 12/88] backends/hostmem: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 14/88] ui/vnc: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 15/88] ui/spice: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 16/88] Main loop: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 17/88] Memory API: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 18/88] memory: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 19/88] exec: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 20/88] Migration: use g_new() family of functions,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 21/88] NBD: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 22/88] LM32: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 23/88] M68K: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 24/88] MIPS: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 25/88] OpenRISC: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-devel] [PATCH 26/88] S390: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06