Consider g_clear_list()
Been looking for prior art, but seems that no one was ever interested in this.
How open would you be to having something like the following?
void
g_clear_list (GList **list_ptr,
GDestroyNotify destroy)
{
GList *list;
list = *list_ptr;
if (list)
{
*list_ptr = NULL;
if (destroy)
g_list_free_full(list, destroy);
else
g_list_free(list);
}
}
’Tis purely for convenience.