qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Eric Blake" <eblake@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"qemu trival" <qemu-trivial@nongnu.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [Qemu-devel] [PATCH 08/88] BT: use g_new() family of functions
Date: Fri,  6 Oct 2017 20:49:03 -0300	[thread overview]
Message-ID: <20171006235023.11952-9-f4bug@amsat.org> (raw)
In-Reply-To: <20171006235023.11952-1-f4bug@amsat.org>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: another use in hw/bt/l2cap.c]
---
 bt-host.c     | 2 +-
 bt-vhci.c     | 2 +-
 hw/bt/core.c  | 4 ++--
 hw/bt/hci.c   | 4 ++--
 hw/bt/l2cap.c | 6 +++---
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/bt-host.c b/bt-host.c
index 2f8f631c25..ad9e45ea43 100644
--- a/bt-host.c
+++ b/bt-host.c
@@ -177,7 +177,7 @@ struct HCIInfo *bt_host_hci(const char *id)
     }
 # endif
 
-    s = g_malloc0(sizeof(struct bt_host_hci_s));
+    s = g_new0(struct bt_host_hci_s, 1);
     s->fd = fd;
     s->hci.cmd_send = bt_host_cmd;
     s->hci.sco_send = bt_host_sco;
diff --git a/bt-vhci.c b/bt-vhci.c
index 9d277c32bf..a885e2b8b9 100644
--- a/bt-vhci.c
+++ b/bt-vhci.c
@@ -157,7 +157,7 @@ void bt_vhci_init(struct HCIInfo *info)
         exit(-1);
     }
 
-    s = g_malloc0(sizeof(struct bt_vhci_s));
+    s = g_new0(struct bt_vhci_s, 1);
     s->fd = fd;
     s->info = info ?: qemu_next_hci();
     s->info->opaque = s;
diff --git a/hw/bt/core.c b/hw/bt/core.c
index 615f0af073..281bb40501 100644
--- a/hw/bt/core.c
+++ b/hw/bt/core.c
@@ -55,7 +55,7 @@ static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
 /* Slaves that don't hold any additional per link state can use these */
 static void bt_dummy_lmp_connection_request(struct bt_link_s *req)
 {
-    struct bt_link_s *link = g_malloc0(sizeof(struct bt_link_s));
+    struct bt_link_s *link = g_new0(struct bt_link_s, 1);
 
     link->slave = req->slave;
     link->host = req->host;
@@ -135,7 +135,7 @@ struct bt_scatternet_s *qemu_find_bt_vlan(int id)
         if (vlan->id == id)
             return &vlan->net;
     }
-    vlan = g_malloc0(sizeof(struct bt_vlan_s));
+    vlan = g_new0(struct bt_vlan_s, 1);
     vlan->id = id;
     pvlan = &first_bt_vlan;
     while (*pvlan != NULL)
diff --git a/hw/bt/hci.c b/hw/bt/hci.c
index 476ebec0ab..08e65eb62e 100644
--- a/hw/bt/hci.c
+++ b/hw/bt/hci.c
@@ -742,7 +742,7 @@ static void bt_hci_connection_reject_event(struct bt_hci_s *hci,
 static void bt_hci_connection_accept(struct bt_hci_s *hci,
                 struct bt_device_s *host)
 {
-    struct bt_hci_link_s *link = g_malloc0(sizeof(struct bt_hci_link_s));
+    struct bt_hci_link_s *link = g_new0(struct bt_hci_link_s, 1);
     evt_conn_complete params;
     uint16_t handle;
     uint8_t status = HCI_SUCCESS;
@@ -2158,7 +2158,7 @@ static void bt_hci_destroy(struct bt_device_s *dev)
 
 struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net)
 {
-    struct bt_hci_s *s = g_malloc0(sizeof(struct bt_hci_s));
+    struct bt_hci_s *s = g_new0(struct bt_hci_s, 1);
 
     s->lm.inquiry_done = timer_new_ns(QEMU_CLOCK_VIRTUAL, bt_hci_inquiry_done, s);
     s->lm.inquiry_next = timer_new_ns(QEMU_CLOCK_VIRTUAL, bt_hci_inquiry_next, s);
diff --git a/hw/bt/l2cap.c b/hw/bt/l2cap.c
index e342045140..94f5067d6e 100644
--- a/hw/bt/l2cap.c
+++ b/hw/bt/l2cap.c
@@ -1241,7 +1241,7 @@ static void l2cap_lmp_connection_request(struct bt_link_s *link)
 
     /* Always accept - we only get called if (dev->device->page_scan).  */
 
-    l2cap = g_malloc0(sizeof(struct slave_l2cap_instance_s));
+    l2cap = g_new0(struct slave_l2cap_instance_s, 1);
     l2cap->link.slave = &dev->device;
     l2cap->link.host = link->host;
     l2cap_init(&l2cap->l2cap, &l2cap->link, 0);
@@ -1262,7 +1262,7 @@ static void l2cap_lmp_connection_complete(struct bt_link_s *link)
         return;
     }
 
-    l2cap = g_malloc0(sizeof(struct l2cap_instance_s));
+    l2cap = g_new0(struct l2cap_instance_s, 1);
     l2cap_init(l2cap, link, 1);
 
     link->acl_mode = acl_active;
@@ -1358,7 +1358,7 @@ void bt_l2cap_psm_register(struct bt_l2cap_device_s *dev, int psm, int min_mtu,
         exit(-1);
     }
 
-    new_psm = g_malloc0(sizeof(*new_psm));
+    new_psm = g_new0(struct bt_l2cap_psm_s, 1);
     new_psm->psm = psm;
     new_psm->min_mtu = min_mtu;
     new_psm->new_channel = new_channel;
-- 
2.14.2

  parent reply	other threads:[~2017-10-06 23:51 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 23:48 [Qemu-devel] [PATCH 00/88] use g_new() family of functions Philippe Mathieu-Daudé
2017-10-06 23:48 ` [Qemu-devel] [PATCH 01/88] cocci: script to use g_new() & friends Philippe Mathieu-Daudé
2017-10-09  7:24   ` Markus Armbruster
2017-11-02  4:16     ` Philippe Mathieu-Daudé
2017-10-06 23:48 ` [Qemu-devel] [PATCH 02/88] cocci: add more g_new() transformations Philippe Mathieu-Daudé
2017-10-09  7:28   ` Markus Armbruster
2017-10-06 23:48 ` [Qemu-devel] [PATCH 03/88] cocci: extract typeof() from g_new() Philippe Mathieu-Daudé
2017-10-06 23:48 ` [Qemu-devel] [PATCH 04/88] cocci: avoid use of g_new0() Philippe Mathieu-Daudé
2017-10-07  3:41   ` Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 05/88] cocci: use g_strfreev() Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 06/88] ARM: use g_new() family of functions Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 07/88] Audio: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` Philippe Mathieu-Daudé [this message]
2017-10-06 23:49 ` [Qemu-devel] [PATCH 09/88] Bootdevice: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 10/88] Character devices: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 11/88] Cryptodev Backends: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 12/88] backends/hostmem: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: " Philippe Mathieu-Daudé
2017-10-07 15:45   ` John Snow
2017-10-06 23:49 ` [Qemu-devel] [PATCH 14/88] ui/vnc: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 15/88] ui/spice: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 16/88] Main loop: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 17/88] Memory API: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 18/88] memory: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 19/88] exec: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 20/88] Migration: " Philippe Mathieu-Daudé
2017-10-07 10:15   ` Juan Quintela
2017-10-06 23:49 ` [Qemu-devel] [PATCH 21/88] NBD: " Philippe Mathieu-Daudé
2017-10-09 17:55   ` Eric Blake
2017-10-06 23:49 ` [Qemu-devel] [PATCH 22/88] LM32: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 23/88] M68K: " Philippe Mathieu-Daudé
2017-10-07  5:51   ` Thomas Huth
2017-10-06 23:49 ` [Qemu-devel] [PATCH 24/88] MIPS: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 25/88] OpenRISC: " Philippe Mathieu-Daudé
2017-10-07  0:15   ` Stafford Horne
2017-10-06 23:49 ` [Qemu-devel] [PATCH 26/88] S390: " Philippe Mathieu-Daudé
2017-10-09  9:36   ` Cornelia Huck
2017-10-10 13:25   ` Cornelia Huck
2017-10-06 23:49 ` [Qemu-devel] [PATCH 27/88] SH4: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 28/88] disas: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 29/88] SPARC: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 30/88] QEMU Guest Agent: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 31/88] QMP: " Philippe Mathieu-Daudé
2017-10-09  7:38   ` Markus Armbruster
2017-10-09  8:11     ` Dr. David Alan Gilbert
2017-10-09 18:04       ` Eric Blake
2017-10-06 23:49 ` [Qemu-devel] [PATCH 32/88] QObject: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 33/88] qom: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 34/88] qapi: " Philippe Mathieu-Daudé
2017-10-09 17:59   ` Eric Blake
2017-10-06 23:49 ` [Qemu-devel] [PATCH 35/88] Record/replay: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 36/88] SLIRP: " Philippe Mathieu-Daudé
2017-10-08 22:20   ` Samuel Thibault
2017-10-06 23:49 ` [Qemu-devel] [PATCH 37/88] TCG: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 38/88] VFIO: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 39/88] hw/i386: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 40/88] hw/xen: " Philippe Mathieu-Daudé
2017-10-10 15:55   ` Anthony PERARD
2017-10-06 23:49 ` [Qemu-devel] [PATCH 41/88] target/i386: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 42/88] XTFPGA: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 43/88] hw/core: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 44/88] hw/core/loader: " Philippe Mathieu-Daudé
2017-10-10  0:03   ` Alistair Francis
2017-10-06 23:49 ` [Qemu-devel] [PATCH 45/88] hw/display: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 46/88] hw/display/vga: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 47/88] hw/i2c: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 48/88] hw/input: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 49/88] hw/misc: " Philippe Mathieu-Daudé
2017-10-09 14:21   ` Gabriel L. Somlo
2017-10-06 23:49 ` [Qemu-devel] [PATCH 50/88] ivshmem: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 51/88] hw/timer: " Philippe Mathieu-Daudé
2017-10-07  0:46   ` xiaoqiang zhao
2017-10-07  0:52   ` xiaoqiang zhao
2017-10-06 23:49 ` [Qemu-devel] [PATCH 52/88] i.MX31: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 53/88] iSCSI: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 54/88] KVM: " Philippe Mathieu-Daudé
2017-10-09 14:21   ` Gabriel L. Somlo
2017-10-06 23:49 ` [Qemu-devel] [PATCH 55/88] PReP: " Philippe Mathieu-Daudé
2017-10-07  4:38   ` David Gibson
2017-10-06 23:49 ` [Qemu-devel] [PATCH 56/88] PowerPC: " Philippe Mathieu-Daudé
2017-10-07  4:39   ` David Gibson
2017-10-06 23:49 ` [Qemu-devel] [PATCH 57/88] ppc: " Philippe Mathieu-Daudé
2017-10-07  4:40   ` David Gibson
2017-10-06 23:49 ` [Qemu-devel] [PATCH 58/88] ppc4xx: " Philippe Mathieu-Daudé
2017-10-07  5:15   ` David Gibson
2017-10-06 23:49 ` [Qemu-devel] [PATCH 59/88] ppce500: " Philippe Mathieu-Daudé
2017-10-07  5:16   ` David Gibson
2017-10-06 23:49 ` [Qemu-devel] [PATCH 60/88] sPAPR: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 61/88] tests: " Philippe Mathieu-Daudé
2017-10-09  6:46   ` Thomas Huth
2017-10-09 16:36   ` John Snow
2017-10-06 23:49 ` [Qemu-devel] [PATCH 62/88] user: " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 63/88] bsd-user/syscall: fix a memory leak on EFAULT, use g_new() Philippe Mathieu-Daudé
2017-10-07  8:48   ` [Qemu-devel] [Qemu-trivial] " Kamil Rytarowski
2017-11-06 19:06   ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-10-06 23:49 ` [Qemu-devel] [PATCH 64/88] user: use g_strfreev() Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 65/88] util: use g_new() family of functions Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 66/88] util/qemu-thread-win32: " Philippe Mathieu-Daudé
2017-10-07  6:47   ` Stefan Weil
2017-10-06 23:50 ` [Qemu-devel] [PATCH 67/88] util/coroutine: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 68/88] virtio: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 69/88] virtio-9p: " Philippe Mathieu-Daudé
2017-10-07 12:51   ` Greg Kurz
2017-10-06 23:50 ` [Qemu-devel] [PATCH 70/88] block: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 71/88] block: avoid use of g_new0() Philippe Mathieu-Daudé
2017-10-07  3:44   ` Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 72/88] hw/block/nvme: use g_new() family of functions Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 73/88] hw/block/xen_disk: avoid use of g_new0() Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 74/88] balloon: use g_new() family of functions Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 75/88] decnumber: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 76/88] dma: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 77/88] dump: " Philippe Mathieu-Daudé
2017-10-09  9:38   ` Cornelia Huck
2017-10-06 23:50 ` [Qemu-devel] [PATCH 78/88] gdb: " Philippe Mathieu-Daudé
2017-10-09  9:38   ` Alex Bennée
2017-10-06 23:50 ` [Qemu-devel] [PATCH 79/88] hmp: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 80/88] numa: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 81/88] hw/acpi: " Philippe Mathieu-Daudé
2017-10-09 15:42   ` Ben Warren
2017-10-06 23:50 ` [Qemu-devel] [PATCH 82/88] hw/ipmi: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 83/88] hw/pci: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 84/88] hw/scsi: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 85/88] hw/usb: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 86/88] net/hub: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 87/88] hw/net/rocker: " Philippe Mathieu-Daudé
2017-10-06 23:50 ` [Qemu-devel] [PATCH 88/88] scripts/coverity-model: " Philippe Mathieu-Daudé
2017-10-09  6:46   ` Markus Armbruster
2017-11-02  4:11     ` Philippe Mathieu-Daudé
2017-10-07  0:04 ` [Qemu-devel] [PATCH 00/88] " Philippe Mathieu-Daudé
2017-10-07  1:26 ` no-reply
2017-10-07  1:27 ` no-reply
2017-10-07 14:18 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171006235023.11952-9-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).