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
|
@ -48,7 +48,7 @@ typedef struct {
|
|||
static GMutex lock;
|
||||
static GHashTable *pages;
|
||||
|
||||
static gint cmp_access_count(gconstpointer a, gconstpointer b)
|
||||
static gint cmp_access_count(gconstpointer a, gconstpointer b, gpointer d)
|
||||
{
|
||||
PageCounters *ea = (PageCounters *) a;
|
||||
PageCounters *eb = (PageCounters *) b;
|
||||
|
@ -83,7 +83,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
|
|||
if (counts && g_list_next(counts)) {
|
||||
GList *it;
|
||||
|
||||
it = g_list_sort(counts, cmp_access_count);
|
||||
it = g_list_sort_with_data(counts, cmp_access_count, NULL);
|
||||
|
||||
for (i = 0; i < limit && it->next; i++, it = it->next) {
|
||||
PageCounters *rec = (PageCounters *) it->data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue