mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 14:23:53 -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
|
@ -98,7 +98,7 @@ static GHashTable *nodes;
|
|||
struct qemu_plugin_scoreboard *state;
|
||||
|
||||
/* SORT_HOTTEST */
|
||||
static gint hottest(gconstpointer a, gconstpointer b)
|
||||
static gint hottest(gconstpointer a, gconstpointer b, gpointer d)
|
||||
{
|
||||
NodeData *na = (NodeData *) a;
|
||||
NodeData *nb = (NodeData *) b;
|
||||
|
@ -107,7 +107,7 @@ static gint hottest(gconstpointer a, gconstpointer b)
|
|||
na->dest_count == nb->dest_count ? 0 : 1;
|
||||
}
|
||||
|
||||
static gint exception(gconstpointer a, gconstpointer b)
|
||||
static gint exception(gconstpointer a, gconstpointer b, gpointer d)
|
||||
{
|
||||
NodeData *na = (NodeData *) a;
|
||||
NodeData *nb = (NodeData *) b;
|
||||
|
@ -116,7 +116,7 @@ static gint exception(gconstpointer a, gconstpointer b)
|
|||
na->early_exit == nb->early_exit ? 0 : 1;
|
||||
}
|
||||
|
||||
static gint popular(gconstpointer a, gconstpointer b)
|
||||
static gint popular(gconstpointer a, gconstpointer b, gpointer d)
|
||||
{
|
||||
NodeData *na = (NodeData *) a;
|
||||
NodeData *nb = (NodeData *) b;
|
||||
|
@ -138,7 +138,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
|
|||
{
|
||||
g_autoptr(GString) result = g_string_new("collected ");
|
||||
GList *data;
|
||||
GCompareFunc sort = &hottest;
|
||||
GCompareDataFunc sort = &hottest;
|
||||
int i = 0;
|
||||
|
||||
g_mutex_lock(&node_lock);
|
||||
|
@ -162,7 +162,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
|
|||
break;
|
||||
}
|
||||
|
||||
data = g_list_sort(data, sort);
|
||||
data = g_list_sort_with_data(data, sort, NULL);
|
||||
|
||||
for (GList *l = data;
|
||||
l != NULL && i < topn;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue