mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
contrib/plugins: Fix type conflict of GLib function pointers
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> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <0fcddfca16ca8da2bdaa7b2c114476f5b73d032b.1745295397.git.ktokunaga.mail@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
141af1b31b
commit
01499add2a
8 changed files with 25 additions and 25 deletions
|
@ -71,7 +71,7 @@ static void plugin_init(void)
|
|||
devices = g_hash_table_new(NULL, NULL);
|
||||
}
|
||||
|
||||
static gint sort_cmp(gconstpointer a, gconstpointer b)
|
||||
static gint sort_cmp(gconstpointer a, gconstpointer b, gpointer d)
|
||||
{
|
||||
DeviceCounts *ea = (DeviceCounts *) a;
|
||||
DeviceCounts *eb = (DeviceCounts *) b;
|
||||
|
@ -79,7 +79,7 @@ static gint sort_cmp(gconstpointer a, gconstpointer b)
|
|||
eb->totals.reads + eb->totals.writes ? -1 : 1;
|
||||
}
|
||||
|
||||
static gint sort_loc(gconstpointer a, gconstpointer b)
|
||||
static gint sort_loc(gconstpointer a, gconstpointer b, gpointer d)
|
||||
{
|
||||
IOLocationCounts *ea = (IOLocationCounts *) a;
|
||||
IOLocationCounts *eb = (IOLocationCounts *) b;
|
||||
|
@ -126,13 +126,13 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
|
|||
if (counts && g_list_next(counts)) {
|
||||
GList *it;
|
||||
|
||||
it = g_list_sort(counts, sort_cmp);
|
||||
it = g_list_sort_with_data(counts, sort_cmp, NULL);
|
||||
|
||||
while (it) {
|
||||
DeviceCounts *rec = (DeviceCounts *) it->data;
|
||||
if (rec->detail) {
|
||||
GList *accesses = g_hash_table_get_values(rec->detail);
|
||||
GList *io_it = g_list_sort(accesses, sort_loc);
|
||||
GList *io_it = g_list_sort_with_data(accesses, sort_loc, NULL);
|
||||
const char *prefix = pattern ? "off" : "pc";
|
||||
g_string_append_printf(report, "%s @ 0x%"PRIx64"\n",
|
||||
rec->name, rec->base);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue