@samitouri / QOSamiQemu / commits / d31a0ebfc8

system/ioport: minor code simplification

Drop needless memset() and replace g_malloc0() with g_new(). Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed May 4, 2026 at 10:32 UTC d31a0ebfc80b8a36dcdd6eba3d911231c27e0a22
1 file changed +1 -2
system/ioport.c
+1 -2
@@ -230,9 +230,8 @@ static void portio_list_add_1(PortioList *piolist,
230 mrpio = MEMORY_REGION_PORTIO_LIST(
231 object_new(TYPE_MEMORY_REGION_PORTIO_LIST));
232 mrpio->portio_opaque = piolist->opaque;
233 - mrpio->ports = g_malloc0(sizeof(MemoryRegionPortio) * (count + 1));
233 + mrpio->ports = g_new0(MemoryRegionPortio, count + 1);
234 memcpy(mrpio->ports, pio_init, sizeof(MemoryRegionPortio) * count);
235 - memset(mrpio->ports + count, 0, sizeof(MemoryRegionPortio));
235
236 /* Adjust the offsets to all be zero-based for the region. */
237 for (i = 0; i < count; ++i) {