[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/20] hw/net/can: Fix type conflict of GLib function pointers
From: |
Kohei Tokunaga |
Subject: |
[PATCH v2 07/20] hw/net/can: Fix type conflict of GLib function pointers |
Date: |
Tue, 22 Apr 2025 14:27:11 +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>
---
hw/net/can/xlnx-versal-canfd.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/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c
index dc242e9215..013ebc10dc 100644
--- a/hw/net/can/xlnx-versal-canfd.c
+++ b/hw/net/can/xlnx-versal-canfd.c
@@ -1278,7 +1278,7 @@ static void tx_fifo_stamp(XlnxVersalCANFDState *s,
uint32_t tb0_regid)
}
}
-static gint g_cmp_ids(gconstpointer data1, gconstpointer data2)
+static gint g_cmp_ids(gconstpointer data1, gconstpointer data2, gpointer d)
{
tx_ready_reg_info *tx_reg_1 = (tx_ready_reg_info *) data1;
tx_ready_reg_info *tx_reg_2 = (tx_ready_reg_info *) data2;
@@ -1318,7 +1318,7 @@ static GSList *prepare_tx_data(XlnxVersalCANFDState *s)
temp->can_id = s->regs[reg_num];
temp->reg_num = reg_num;
list = g_slist_prepend(list, temp);
- list = g_slist_sort(list, g_cmp_ids);
+ list = g_slist_sort_with_data(list, g_cmp_ids, NULL);
}
reg_ready >>= 1;
--
2.25.1
- [PATCH v2 02/20] qom/object.c: Fix type conflict of GLib function pointers, (continued)
- [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, 2025/04/22
- [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 <=
- [PATCH v2 09/20] target/s390x: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 11/20] util/cacheflush.c: Update cache flushing mechanism for Emscripten, Kohei Tokunaga, 2025/04/22
- [PATCH v2 10/20] include/glib-compat.h: Poison g_list_sort and g_slist_sort, Kohei Tokunaga, 2025/04/22