qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH 46/88] hw/display/vga: use g_new() family of funct


From: Philippe Mathieu-Daudé
Subject: [Qemu-trivial] [PATCH 46/88] hw/display/vga: use g_new() family of functions
Date: Fri, 6 Oct 2017 20:49:41 -0300

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
Gerd: should those files go under Graphics section in MAINTAINERS?

 hw/display/vga-isa-mm.c | 6 +++---
 hw/display/vga.c        | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/display/vga-isa-mm.c b/hw/display/vga-isa-mm.c
index 51ccbccc41..7af72864df 100644
--- a/hw/display/vga-isa-mm.c
+++ b/hw/display/vga-isa-mm.c
@@ -105,12 +105,12 @@ static void vga_mm_init(ISAVGAMMState *s, hwaddr 
vram_base,
     MemoryRegion *s_ioport_ctrl, *vga_io_memory;
 
     s->it_shift = it_shift;
-    s_ioport_ctrl = g_malloc(sizeof(*s_ioport_ctrl));
+    s_ioport_ctrl = g_new(MemoryRegion, 1);
     memory_region_init_io(s_ioport_ctrl, NULL, &vga_mm_ctrl_ops, s,
                           "vga-mm-ctrl", 0x100000);
     memory_region_set_flush_coalesced(s_ioport_ctrl);
 
-    vga_io_memory = g_malloc(sizeof(*vga_io_memory));
+    vga_io_memory = g_new(MemoryRegion, 1);
     /* XXX: endianness? */
     memory_region_init_io(vga_io_memory, NULL, &vga_mem_ops, &s->vga,
                           "vga-mem", 0x20000);
@@ -130,7 +130,7 @@ int isa_vga_mm_init(hwaddr vram_base,
 {
     ISAVGAMMState *s;
 
-    s = g_malloc0(sizeof(*s));
+    s = g_new0(ISAVGAMMState, 1);
 
     s->vga.vram_size_mb = VGA_RAM_SIZE >> 20;
     vga_common_init(&s->vga, NULL, true);
diff --git a/hw/display/vga.c b/hw/display/vga.c
index ed24ef7076..bdefa60f30 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2236,7 +2236,7 @@ MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
     *vga_ports = vga_portio_list;
     *vbe_ports = vbe_portio_list;
 
-    vga_mem = g_malloc(sizeof(*vga_mem));
+    vga_mem = g_new(MemoryRegion, 1);
     memory_region_init_io(vga_mem, obj, &vga_mem_ops, s,
                           "vga-lowmem", 0x20000);
     memory_region_set_flush_coalesced(vga_mem);
-- 
2.14.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]