From nobody Tue Feb 10 23:00:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507334445104659.1969625408452; Fri, 6 Oct 2017 17:00:45 -0700 (PDT) Received: from localhost ([::1]:47569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0cXf-0006e1-9s for importer@patchew.org; Fri, 06 Oct 2017 20:00:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0cOy-0007QL-Ne for qemu-devel@nongnu.org; Fri, 06 Oct 2017 19:51:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0cOx-00058a-JJ for qemu-devel@nongnu.org; Fri, 06 Oct 2017 19:51:32 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:45324) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e0cOx-00058T-Eo; Fri, 06 Oct 2017 19:51:31 -0400 Received: by mail-qt0-x241.google.com with SMTP id k1so23349374qti.2; Fri, 06 Oct 2017 16:51:31 -0700 (PDT) Received: from yoga.lan ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id g1sm1705226qta.95.2017.10.06.16.51.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 16:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4b4CTy0mjMj84x5yyngO61akbi5W7kWydDy+5g+X4fk=; b=JwIhn6MWJcZDj8a7z1XYzhkyu0IfFkXkAUT8lbxS90aczRvEXgPuIGuZS12FZBw9Hm UWmfRi7iTrhX9gZ7jARiSYGVqDcn31aDpJS10CRsAoPnex0YS8iBNdV1Adxnc10YGZek DNxULFMamkSSeD+SA79o5awwFAITUugAicBz0UGFoGG+hAHAuO2qiHWR0AHztsWv9AII 7bpH7XUWLTr3nmKX60c2dw1K/YPvdLgSEQkaU/W9pjRfhk3gkOQtdYRvT8XJYTuRyV8N 1Yx1j/wFs9NEKEqpx8B23foPyJ1K7g+n08e0rwOdqoiwP/Igy55EW+LeagPkOabuu74B ndMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4b4CTy0mjMj84x5yyngO61akbi5W7kWydDy+5g+X4fk=; b=q7vjH4kbaQB4hQBhvgfBUpKFPIWkzNWtA+GhZ7ogARsH1fra8/5lM9QDxsxfIs/Ma/ zieiYJrYSbALnNWPaQ8VKfMsqnI5T6idcIX5ja/4zXZRFhl2NuQWbylRYJt2h9xCa81q igFRvkb5yu3IZn+/QrTrGZFE9Fwh19o+gxCDydvaQXbnXx8HyFafd9JGR6UtKuLkrwvh zzDubqUTQIgzm9vw8pfh7eZ7HwYev9u6gdcCY3LOXsrLfRw+QUtWB+c0kQMWeyRHmbhY hKGSE9RHTutWmPnH2j25k+Fxm9Gaa9n8A+GaYf4XVpnssYhtAUsZuL5dvLHsJWaSvZ3A bUUg== X-Gm-Message-State: AMCzsaWFr43VqCXOL6n7HmLW/g6/kSfepoKoQ66x1zqr2uiPIjP7uo7o sFWACKFA7u8rdIjJTOrMOds= X-Google-Smtp-Source: AOwi7QBoqeq0LC8MFo/EYTVSfMTE8SkS87waQvadkGLLmZ8U8OPLd2wHPqueo3NOGy9/q0BuOkc/Pg== X-Received: by 10.237.33.203 with SMTP id m11mr5548415qtc.123.1507333890896; Fri, 06 Oct 2017 16:51:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Blake , Paolo Bonzini Date: Fri, 6 Oct 2017 20:49:11 -0300 Message-Id: <20171006235023.11952-17-f4bug@amsat.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171006235023.11952-1-f4bug@amsat.org> References: <20171006235023.11952-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH 16/88] Main loop: use g_new() family of functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu trival , qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Philippe Mathieu-Daud=C3=A9 [PMD: more uses in vl.c (fixed const char * cast), squashed cpus-common and changes in util/qemu-timer] --- include/qemu/timer.h | 2 +- cpus-common.c | 4 ++-- util/main-loop.c | 2 +- util/qemu-timer.c | 2 +- vl.c | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 1b518bca30..dfc028259c 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -518,7 +518,7 @@ static inline QEMUTimer *timer_new_tl(QEMUTimerList *ti= mer_list, QEMUTimerCB *cb, void *opaque) { - QEMUTimer *ts =3D g_malloc0(sizeof(QEMUTimer)); + QEMUTimer *ts =3D g_new0(QEMUTimer, 1); timer_init_tl(ts, timer_list, scale, cb, opaque); return ts; } diff --git a/cpus-common.c b/cpus-common.c index 59f751ecf9..e613cc33ef 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -158,7 +158,7 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func fu= nc, run_on_cpu_data data) { struct qemu_work_item *wi; =20 - wi =3D g_malloc0(sizeof(struct qemu_work_item)); + wi =3D g_new0(struct qemu_work_item, 1); wi->func =3D func; wi->data =3D data; wi->free =3D true; @@ -301,7 +301,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_fu= nc func, { struct qemu_work_item *wi; =20 - wi =3D g_malloc0(sizeof(struct qemu_work_item)); + wi =3D g_new0(struct qemu_work_item, 1); wi->func =3D func; wi->data =3D data; wi->free =3D true; diff --git a/util/main-loop.c b/util/main-loop.c index 7558eb5f53..ef784bcda0 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -279,7 +279,7 @@ static PollingEntry *first_polling_entry; int qemu_add_polling_cb(PollingFunc *func, void *opaque) { PollingEntry **ppe, *pe; - pe =3D g_malloc0(sizeof(PollingEntry)); + pe =3D g_new0(PollingEntry, 1); pe->func =3D func; pe->opaque =3D opaque; for(ppe =3D &first_polling_entry; *ppe !=3D NULL; ppe =3D &(*ppe)->nex= t); diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 82d56507a2..2f4e21c482 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -102,7 +102,7 @@ QEMUTimerList *timerlist_new(QEMUClockType type, QEMUTimerList *timer_list; QEMUClock *clock =3D qemu_clock_ptr(type); =20 - timer_list =3D g_malloc0(sizeof(QEMUTimerList)); + timer_list =3D g_new0(QEMUTimerList, 1); qemu_event_init(&timer_list->timers_done_ev, true); timer_list->clock =3D clock; timer_list->notify_cb =3D cb; diff --git a/vl.c b/vl.c index 3fed457921..9f82a375b3 100644 --- a/vl.c +++ b/vl.c @@ -1416,7 +1416,7 @@ static int add_semihosting_arg(void *opaque, if (strcmp(name, "arg") =3D=3D 0) { s->argc++; /* one extra element as g_strjoinv() expects NULL-terminated array= */ - s->argv =3D g_realloc(s->argv, (s->argc + 1) * sizeof(void *)); + s->argv =3D g_renew(const char *, s->argv, s->argc + 1); s->argv[s->argc - 1] =3D val; s->argv[s->argc] =3D NULL; } @@ -1589,7 +1589,7 @@ MachineInfoList *qmp_query_machines(Error **errp) MachineInfoList *entry; MachineInfo *info; =20 - info =3D g_malloc0(sizeof(*info)); + info =3D g_new0(MachineInfo, 1); if (mc->is_default) { info->has_is_default =3D true; info->is_default =3D true; @@ -1604,7 +1604,7 @@ MachineInfoList *qmp_query_machines(Error **errp) info->cpu_max =3D !mc->max_cpus ? 1 : mc->max_cpus; info->hotpluggable_cpus =3D mc->has_hotpluggable_cpus; =20 - entry =3D g_malloc0(sizeof(*entry)); + entry =3D g_new0(MachineInfoList, 1); entry->value =3D info; entry->next =3D mach_list; mach_list =3D entry; @@ -1657,7 +1657,7 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(= VMChangeStateHandler *cb, { VMChangeStateEntry *e; =20 - e =3D g_malloc0(sizeof (*e)); + e =3D g_new0(VMChangeStateEntry, 1); =20 e->cb =3D cb; e->opaque =3D opaque; @@ -2546,7 +2546,7 @@ static void add_device_config(int type, const char *c= mdline) { struct device_config *conf; =20 - conf =3D g_malloc0(sizeof(*conf)); + conf =3D g_new0(struct device_config, 1); conf->type =3D type; conf->cmdline =3D cmdline; loc_save(&conf->loc); @@ -3047,7 +3047,7 @@ static int global_init_func(void *opaque, QemuOpts *o= pts, Error **errp) { GlobalProperty *g; =20 - g =3D g_malloc0(sizeof(*g)); + g =3D g_new0(GlobalProperty, 1); g->driver =3D qemu_opt_get(opts, "driver"); g->property =3D qemu_opt_get(opts, "property"); g->value =3D qemu_opt_get(opts, "value"); --=20 2.14.2