On 07/28/2016 03:36 PM, Marc-André Lureau wrote: >>> + g_list_foreach(config->blacklist, (GFunc)g_free, NULL); >> >> What an ugly cast - undefined behavior according to C. But it happens to >> work on all ABI that we support (calling a unary function as cast to >> appear as a binary function silently ignores the second argument), so I >> could sort of live with it, if it made the patch arguably smaller due to >> fewer lines of code than required for a type-correct solution. > > > Note that's how glib implements g_slist_free_full() and others, I just used the same common code/style Just because glib disregards C type safety and relies on platform ABI doesn't mean we have to be equally cavalier in our code. Again, I'm not outright rejecting your shorter style, precisely because glib already uses the style (so it already happens to work), but do think that it is easier to maintain code that doesn't have ugly casts (where I have to think about ABI issues) because it is C-compliant to begin with. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org