qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH v2] configure: require glib-2.24


From: Olaf Hering
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v2] configure: require glib-2.24 on Linux
Date: Wed, 18 Apr 2018 17:31:47 +0200

Am Wed, 18 Apr 2018 10:04:03 -0500
schrieb Eric Blake <address@hidden>:

> Rather than hacking configure, why not fix util/vfio-helpers.c to avoid
> g_realloc_n()?  We've done it before; see commit 071d405

I can not really test it, this variant may work:

--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -522,8 +522,7 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState *s,
 
     assert(index >= 0);
     s->nr_mappings++;
-    s->mappings = g_realloc_n(s->mappings, sizeof(s->mappings[0]),
-                              s->nr_mappings);
+    s->mappings = g_renew(IOVAMapping *, s->mappings, s->nr_mappings);
     insert = &s->mappings[index];
     shift = s->nr_mappings - index - 1;
     if (shift) {
@@ -577,8 +576,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, 
IOVAMapping *mapping,
     memmove(mapping, &s->mappings[index + 1],
             sizeof(s->mappings[0]) * (s->nr_mappings - index - 1));
     s->nr_mappings--;
-    s->mappings = g_realloc_n(s->mappings, sizeof(s->mappings[0]),
-                              s->nr_mappings);
+    s->mappings = g_renew(IOVAMapping *, s->mappings, s->nr_mappings);
 }
 
 /* Check if the mapping list is (ascending) ordered. */

Olaf

Attachment: pgpvjbBZpLKQN.pgp
Description: Digitale Signatur von OpenPGP


reply via email to

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