From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Pavel Pisa" <pisa@cmp.felk.cvut.cz>,
"Francisco Iglesias" <francisco.iglesias@amd.com>,
"Vikram Garhwal" <vikram.garhwal@bytedance.com>,
"Jason Wang" <jasowang@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"David Hildenbrand" <david@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
qemu-s390x@nongnu.org
Subject: Re: [PATCH 01/19] hw/core/loader.c: Fix type conflict of GLib function pointers
Date: Wed, 16 Apr 2025 09:28:36 +0100 [thread overview]
Message-ID: <Z_9qIQhjsI5zOwXA@redhat.com> (raw)
In-Reply-To: <44e9ef95ea6e8aa33560ca8580db0033623f0e91.1744787186.git.ktokunaga.mail@gmail.com>
On Wed, Apr 16, 2025 at 05:14:06PM +0900, Kohei Tokunaga wrote:
> On emscripten, function pointer casts can cause function call failure.
> This commit fixes the function definition to match to the type of the
> function call using g_list_sort_with_data.
>
> Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
> ---
> hw/core/loader.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index 2e35f0aa90..93a8b45d28 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -1410,7 +1410,7 @@ typedef struct RomSec {
> * work, but this way saves a little work later by avoiding
> * dealing with "gaps" of 0 length.
> */
> -static gint sort_secs(gconstpointer a, gconstpointer b)
> +static gint sort_secs(gconstpointer a, gconstpointer b, gpointer d)
> {
> RomSec *ra = (RomSec *) a;
> RomSec *rb = (RomSec *) b;
> @@ -1463,7 +1463,7 @@ RomGap rom_find_largest_gap_between(hwaddr base, size_t size)
> /* sentinel */
> secs = add_romsec_to_list(secs, base + size, 1);
>
> - secs = g_list_sort(secs, sort_secs);
> + secs = g_list_sort_with_data(secs, sort_secs, NULL);
I don't see what the problem is with the original code.
The commit message says we have a bad function cast, but the original
method decl is
GList *g_list_sort(GList*list, GCompareFunc compare_func);
where the callback is
typedef gint (*GCompareFunc)(gconstpointer a, gconstpointer b);
Our code complies with that GCompareFunc signature.
For comparison the new code uses:
GList *g_list_sort_with_data(GList *list, GCompareDataFunc compare_func, gpointer user_data);
where the callback is
typedef gint (*GCompareDataFunc)(gconstpointer a, gconstpointer b, gpointer user_data);
which the new code complies with, but it is undesirable since we
have no use for the data parameter.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-04-16 8:29 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 8:14 [PATCH 00/19] Enable QEMU TCI to run 32bit guests on browsers Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 01/19] hw/core/loader.c: Fix type conflict of GLib function pointers Kohei Tokunaga
2025-04-16 8:28 ` Daniel P. Berrangé [this message]
2025-04-16 9:00 ` Paolo Bonzini
2025-04-16 9:12 ` Daniel P. Berrangé
2025-04-16 9:31 ` Paolo Bonzini
2025-04-17 9:18 ` Kohei Tokunaga
2025-04-16 9:14 ` Thomas Huth
2025-04-16 9:35 ` Philippe Mathieu-Daudé
2025-04-17 9:07 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 02/19] qom/object.c: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 03/19] system/vl.c: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 04/19] target/arm/helper.c: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 05/19] target/i386/cpu.c: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 06/19] contrib/plugins: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 07/19] hw/net/can: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 08/19] target/ppc: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 09/19] target/s390x: " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 10/19] include/glib-compat.h: Poison g_list_sort and g_slist_sort Kohei Tokunaga
2025-04-16 11:56 ` BALATON Zoltan
2025-04-17 9:20 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 11/19] util/cacheflush.c: Update cache flushing mechanism for Emscripten Kohei Tokunaga
2025-04-16 9:37 ` Philippe Mathieu-Daudé
2025-04-17 9:27 ` Kohei Tokunaga
2025-04-17 9:50 ` Philippe Mathieu-Daudé
2025-04-16 8:14 ` [PATCH 12/19] block: Update block to compile with Emscripten Kohei Tokunaga
2025-04-16 9:00 ` Philippe Mathieu-Daudé
2025-04-16 9:33 ` Philippe Mathieu-Daudé
2025-04-16 15:45 ` Richard Henderson
2025-04-17 9:32 ` Kohei Tokunaga
2025-04-17 9:55 ` Philippe Mathieu-Daudé
2025-04-18 6:53 ` Kohei Tokunaga
2025-04-18 9:51 ` Philippe Mathieu-Daudé
2025-04-17 9:43 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 13/19] include/qemu/osdep.h: Add Emscripten-specific OS dependencies Kohei Tokunaga
2025-04-17 9:58 ` Philippe Mathieu-Daudé
2025-04-18 6:55 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 14/19] Disable options unsupported on Emscripten Kohei Tokunaga
2025-04-16 9:03 ` Philippe Mathieu-Daudé
2025-04-17 9:33 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 15/19] util/mmap-alloc: Add qemu_ram_mmap implementation for emscripten Kohei Tokunaga
2025-04-16 9:18 ` Philippe Mathieu-Daudé
2025-04-17 9:35 ` Kohei Tokunaga
2025-04-21 3:23 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 16/19] util: Add coroutine backend " Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 17/19] meson: Add wasm build in build scripts Kohei Tokunaga
2025-04-16 9:22 ` Philippe Mathieu-Daudé
2025-04-17 9:37 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 18/19] gitlab: Enable CI for wasm build Kohei Tokunaga
2025-04-16 9:23 ` Philippe Mathieu-Daudé
2025-04-17 9:39 ` Kohei Tokunaga
2025-04-16 8:14 ` [PATCH 19/19] MAINTAINERS: Update MAINTAINERS file for wasm-related files Kohei Tokunaga
2025-04-16 9:34 ` Philippe Mathieu-Daudé
2025-04-17 9:40 ` Kohei Tokunaga
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=Z_9qIQhjsI5zOwXA@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=danielhb413@gmail.com \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=erdnaxe@crans.org \
--cc=francisco.iglesias@amd.com \
--cc=hreitz@redhat.com \
--cc=iii@linux.ibm.com \
--cc=jasowang@redhat.com \
--cc=ktokunaga.mail@gmail.com \
--cc=kwolf@redhat.com \
--cc=ma.mandourr@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=pisa@cmp.felk.cvut.cz \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=vikram.garhwal@bytedance.com \
--cc=zhao1.liu@intel.com \
/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.