All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-trivial@nongnu.org,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Fam Zheng" <famz@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] configure: require glib-2.24 on Linux
Date: Wed, 18 Apr 2018 17:31:47 +0200	[thread overview]
Message-ID: <20180418173147.07667af9.olaf@aepfle.de> (raw)
In-Reply-To: <7df49e91-aa65-d775-78eb-ddf53676dd7f@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

Am Wed, 18 Apr 2018 10:04:03 -0500
schrieb Eric Blake <eblake@redhat.com>:

> 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 #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2018-04-18 15:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 14:54 [Qemu-devel] [PATCH v2] configure: require glib-2.24 on Linux Olaf Hering
2018-04-18 15:04 ` Eric Blake
2018-04-18 15:31   ` Olaf Hering [this message]
2018-04-18 15:37   ` Olaf Hering
2018-04-18 15:05 ` no-reply
2018-04-18 15:42 ` Paolo Bonzini

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=20180418173147.07667af9.olaf@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=eblake@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=famz@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.