[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/20] system/vl.c: Fix type conflict of GLib function pointer
From: |
Kohei Tokunaga |
Subject: |
[PATCH v2 03/20] system/vl.c: Fix type conflict of GLib function pointers |
Date: |
Tue, 22 Apr 2025 14:27:07 +0900 |
On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
---
system/vl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts are performed internally by GLib.
diff --git a/system/vl.c b/system/vl.c
index ec93988a03..8d89394b45 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1523,7 +1523,7 @@ static bool debugcon_parse(const char *devname, Error
**errp)
return true;
}
-static gint machine_class_cmp(gconstpointer a, gconstpointer b)
+static gint machine_class_cmp(gconstpointer a, gconstpointer b, gpointer d)
{
const MachineClass *mc1 = a, *mc2 = b;
int res;
@@ -1573,7 +1573,7 @@ static void machine_help_func(const QDict *qdict)
}
printf("Supported machines are:\n");
- machines = g_slist_sort(machines, machine_class_cmp);
+ machines = g_slist_sort_with_data(machines, machine_class_cmp, NULL);
for (el = machines; el; el = el->next) {
MachineClass *mc = el->data;
if (mc->alias) {
--
2.25.1
- [PATCH v2 00/20] Enable QEMU TCI to run 32bit guests on browsers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 01/20] hw/core/loader.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 02/20] qom/object.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 03/20] system/vl.c: Fix type conflict of GLib function pointers,
Kohei Tokunaga <=
- [PATCH v2 04/20] target/arm/helper.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 05/20] target/i386/cpu.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 06/20] contrib/plugins: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 07/20] hw/net/can: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22