Add support for g_auto(s)list to G_DECLARE'd types
G_DECLARE_DERIVABLE_TYPE
and G_DECLARE_FINAL_TYPE
uses _GLIB_DEFINE_AUTOPTR_CHAINUP
to declare glib_autoptr_cleanup_*
functions, but they lack of support for lists.
Added such support, refactored a bit the code to avoid duplication (this last commit isn't the nicest maybe, so we can discuss how to get it nicer or just keep the duplication - this is also another option 3v1n0/glib@b0eafa16 that can be factorized more too), and added tests to check this.
EDIT: also, wondering... Wouldn't be the case to have G_DEFINE_AUTOPTR_CLEANUP_FUNC(char, g_free)
as global to make possible to use g_autoptr(char)
(which I don't like much to be honest, since we already have g_autofree
for this, but instead we might set it only for gchar
or define a new type), but most of all g_auto(s)list(char)
set for everybody?
Or better, adding a new G_DEFINE_AUTOPTR_LISTS_CLEANUP_FUNCS(char, g_free)
or something like this in case we only want to serve the g_autolist
case?