From nobody Tue Feb 10 23:00:52 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 1507336739028245.87421538668934; Fri, 6 Oct 2017 17:38:59 -0700 (PDT) Received: from localhost ([::1]:47800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0d8n-0006y9-3s for importer@patchew.org; Fri, 06 Oct 2017 20:38:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0cRj-0001cZ-92 for qemu-devel@nongnu.org; Fri, 06 Oct 2017 19:54:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0cRi-0007Na-4N for qemu-devel@nongnu.org; Fri, 06 Oct 2017 19:54:23 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:36761) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e0cRh-0007My-VT; Fri, 06 Oct 2017 19:54:22 -0400 Received: by mail-qk0-x242.google.com with SMTP id z14so12862240qkg.3; Fri, 06 Oct 2017 16:54:21 -0700 (PDT) Received: from yoga.lan ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id g1sm1705226qta.95.2017.10.06.16.54.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 16:54:20 -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=nq9BCKrICxD9bnF6ixu6+BxmBS0KBKlFFaxPU6YfRjo=; b=srzq5j0j4YuhOSFloTzQ7x/2gRc1xfeARMJxOoj4CztezY8q0Wl6cjkhey1k8OyltR +grh14lyFLBPcJA18Xe7wdMHhvYcTdIjXvF9IP0tiKO6a/1vSHGpGDOzK4MJG6NGQFqk RIzZGNRMGerXzIqWafjDL1NAkoqcVWsCTpzk/R6Uu6HKJZ16sI4LkdwtcVsn5wK/47t3 5w8VHeu9UhmWWQiMh2yFfCbm/DJvhSptEFFB4WShPSemFMA7+VJVafnwoWNInwSDN+Z0 wGCOHcabasuz612aISZw2vRdiwrK4V9vcMC7NSsj/vdl+pOq+GDb7Fr0cbzyr+dRzQcq mmuw== 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=nq9BCKrICxD9bnF6ixu6+BxmBS0KBKlFFaxPU6YfRjo=; b=Qo+JrRI8PR2Kp0ziOPq+ZaURGp6KIrYsLVseNSX0HZRvEiP3YRFxDEpvyqjc73ySba 3uZSpqRkgoYLPUW7DTtwXGRyNeSlqTZTEhLX04hpZLR6N9zr1fADGzUbeUfEqSHeGgk0 46X/5jN4eN7OL90pxICR87Bnmab2bkyZ2+2MG4gwLcnV80PCWD/uFv01avpyFF0yGG1P Z5Pqtbcz4XcGq8wl+HMtbGiepZAZkIkS6mvLThkZ+LasNJ5/77IS3K93eW+wEP6o1CZ9 ARiqfrnZzh7ijppfqohF4OPkMVOWeY5VpzYPN16CF6sxmq3OagnlfLkeHrNo7MzAtOxi A1Mw== X-Gm-Message-State: AMCzsaUQDImnINOx4MmXULqZFnZozhB++jFBJf209ANObJszjXNN2Z6+ N6cIvHVNlx/K2bMGx5FA8l4= X-Google-Smtp-Source: AOwi7QApzWhqXHKxTHEIhjGxB0E2J10nEXJsph7n5K4TcWwSKBHLPDPugY5S4lqBUKn7GATKx++luw== X-Received: by 10.55.183.134 with SMTP id h128mr712846qkf.96.1507334061380; Fri, 06 Oct 2017 16:54:21 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Blake , Stefan Hajnoczi , Max Reitz , Fam Zheng Date: Fri, 6 Oct 2017 20:50:00 -0300 Message-Id: <20171006235023.11952-66-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:c09::242 Subject: [Qemu-devel] [PATCH 65/88] util: 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 changes in util/envlist.c, more files updated] --- util/acl.c | 6 +++--- util/envlist.c | 6 +++--- util/error.c | 2 +- util/iohandler.c | 2 +- util/module.c | 4 ++-- util/qemu-option.c | 8 ++++---- util/qht.c | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/util/acl.c b/util/acl.c index c105addadc..f5d8295fe2 100644 --- a/util/acl.c +++ b/util/acl.c @@ -56,7 +56,7 @@ qemu_acl *qemu_acl_init(const char *aclname) if (acl) return acl; =20 - acl =3D g_malloc(sizeof(*acl)); + acl =3D g_new(qemu_acl, 1); acl->aclname =3D g_strdup(aclname); /* Deny by default, so there is no window of "open * access" between QEMU starting, and the user setting @@ -117,7 +117,7 @@ int qemu_acl_append(qemu_acl *acl, { qemu_acl_entry *entry; =20 - entry =3D g_malloc(sizeof(*entry)); + entry =3D g_new(qemu_acl_entry, 1); entry->match =3D g_strdup(match); entry->deny =3D deny; =20 @@ -146,7 +146,7 @@ int qemu_acl_insert(qemu_acl *acl, i++; if (i =3D=3D index) { qemu_acl_entry *entry; - entry =3D g_malloc(sizeof(*entry)); + entry =3D g_new(qemu_acl_entry, 1); entry->match =3D g_strdup(match); entry->deny =3D deny; =20 diff --git a/util/envlist.c b/util/envlist.c index 1eeb7fca87..5934095b7d 100644 --- a/util/envlist.c +++ b/util/envlist.c @@ -24,7 +24,7 @@ envlist_create(void) { envlist_t *envlist; =20 - envlist =3D g_malloc(sizeof(*envlist)); + envlist =3D g_new(envlist_t, 1); =20 QLIST_INIT(&envlist->el_entries); envlist->el_count =3D 0; @@ -158,7 +158,7 @@ envlist_setenv(envlist_t *envlist, const char *env) envlist->el_count++; } =20 - entry =3D g_malloc(sizeof(*entry)); + entry =3D g_new(struct envlist_entry, 1); entry->ev_var =3D g_strdup(env); QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link); =20 @@ -218,7 +218,7 @@ envlist_to_environ(const envlist_t *envlist, size_t *co= unt) struct envlist_entry *entry; char **env, **penv; =20 - penv =3D env =3D g_malloc((envlist->el_count + 1) * sizeof(char *)); + penv =3D env =3D g_new(char *, envlist->el_count + 1); =20 for (entry =3D envlist->el_entries.lh_first; entry !=3D NULL; entry =3D entry->ev_link.le_next) { diff --git a/util/error.c b/util/error.c index 3efdd69162..cfb829b1f8 100644 --- a/util/error.c +++ b/util/error.c @@ -56,7 +56,7 @@ static void error_setv(Error **errp, } assert(*errp =3D=3D NULL); =20 - err =3D g_malloc0(sizeof(*err)); + err =3D g_new0(Error, 1); err->msg =3D g_strdup_vprintf(fmt, ap); if (suffix) { char *msg =3D err->msg; diff --git a/util/iohandler.c b/util/iohandler.c index 623b55b9ec..518922dcea 100644 --- a/util/iohandler.c +++ b/util/iohandler.c @@ -128,7 +128,7 @@ int qemu_add_child_watch(pid_t pid) return 1; } } - rec =3D g_malloc0(sizeof(ChildProcessRecord)); + rec =3D g_new0(ChildProcessRecord, 1); rec->pid =3D pid; QLIST_INSERT_HEAD(&child_watches, rec, next); return 0; diff --git a/util/module.c b/util/module.c index c90973721f..1533dbdc63 100644 --- a/util/module.c +++ b/util/module.c @@ -65,7 +65,7 @@ void register_module_init(void (*fn)(void), module_init_t= ype type) ModuleEntry *e; ModuleTypeList *l; =20 - e =3D g_malloc0(sizeof(*e)); + e =3D g_new0(ModuleEntry, 1); e->init =3D fn; e->type =3D type; =20 @@ -80,7 +80,7 @@ void register_dso_module_init(void (*fn)(void), module_in= it_type type) =20 init_lists(); =20 - e =3D g_malloc0(sizeof(*e)); + e =3D g_new0(ModuleEntry, 1); e->init =3D fn; e->type =3D type; =20 diff --git a/util/qemu-option.c b/util/qemu-option.c index 9b1dc8093b..8a121bfc40 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -534,7 +534,7 @@ static void opt_set(QemuOpts *opts, const char *name, c= onst char *value, return; } =20 - opt =3D g_malloc0(sizeof(*opt)); + opt =3D g_new0(QemuOpt, 1); opt->name =3D g_strdup(name); opt->opts =3D opts; if (prepend) { @@ -564,7 +564,7 @@ void qemu_opt_set_bool(QemuOpts *opts, const char *name= , bool val, QemuOpt *opt; const QemuOptDesc *desc =3D opts->list->desc; =20 - opt =3D g_malloc0(sizeof(*opt)); + opt =3D g_new0(QemuOpt, 1); opt->desc =3D find_desc_by_name(desc, name); if (!opt->desc && !opts_accepts_any(opts)) { error_setg(errp, QERR_INVALID_PARAMETER, name); @@ -585,7 +585,7 @@ void qemu_opt_set_number(QemuOpts *opts, const char *na= me, int64_t val, QemuOpt *opt; const QemuOptDesc *desc =3D opts->list->desc; =20 - opt =3D g_malloc0(sizeof(*opt)); + opt =3D g_new0(QemuOpt, 1); opt->desc =3D find_desc_by_name(desc, name); if (!opt->desc && !opts_accepts_any(opts)) { error_setg(errp, QERR_INVALID_PARAMETER, name); @@ -665,7 +665,7 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const ch= ar *id, return opts; } } - opts =3D g_malloc0(sizeof(*opts)); + opts =3D g_new0(QemuOpts, 1); opts->id =3D g_strdup(id); opts->list =3D list; loc_save(&opts->loc); diff --git a/util/qht.c b/util/qht.c index ff4d2e6974..c5d153d573 100644 --- a/util/qht.c +++ b/util/qht.c @@ -331,7 +331,7 @@ static struct qht_map *qht_map_create(size_t n_buckets) struct qht_map *map; size_t i; =20 - map =3D g_malloc(sizeof(*map)); + map =3D g_new(struct qht_map, 1); map->n_buckets =3D n_buckets; =20 map->n_added_buckets =3D 0; --=20 2.14.2