Il mer 16 apr 2025, 10:29 Daniel P. Berrangé <berra...@redhat.com> ha scritto:
> > - secs = g_list_sort(secs, sort_secs); > > + secs = g_list_sort_with_data(secs, sort_secs, NULL); > > I don't see what the problem is with the original code. > > The commit message says we have a bad function cast, but the original > method decl is > > GList *g_list_sort(GList*list, GCompareFunc compare_func); > > where the callback is > > typedef gint (*GCompareFunc)(gconstpointer a, gconstpointer b); > > Our code complies with that GCompareFunc signature. > The cast is inside glib; g_list_sort casts the function pointer and calls g_list_sort_with_data. I suggested this solution to Kohei because it's easy to check that we're converting all users and not introducing new ones in the future (see poisoning in patch 10). Paolo For comparison the new code uses: > > GList *g_list_sort_with_data(GList *list, GCompareDataFunc > compare_func, gpointer user_data); > > where the callback is > > typedef gint (*GCompareDataFunc)(gconstpointer a, gconstpointer b, > gpointer user_data); > > which the new code complies with, but it is undesirable since we > have no use for the data parameter. > > With regards, > Daniel > -- > |: https://berrange.com -o- > https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- > https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- > https://www.instagram.com/dberrange :| > >