WrapEarnPass created an issue (geany/geany-plugins#1588)
I know I am guilty of this too, as I copied my list free'er directly from
ProjectOrganizer
```g_slist_foreach(list, (GFunc) g_free, NULL); ``` is poor form as it requires
the developer to remember to actually free the list, or leak memory.
the expected free'er for an entire slist is
```g_slist_free_full(list, g_free);```
These all throw warnings about cast-function-type
```
./workbench/src/wb_project.c: g_slist_foreach(lst, (GFunc) g_free, NULL);
./workbench/src/wb_project.c: g_slist_foreach(scanned, (GFunc)
g_free, NULL);
./codenav/src/goto_file.c: g_slist_foreach(files_list, (GFunc) g_free,
NULL);
./codenav/src/switch_head_impl.c:
g_slist_foreach(lang->head_extensions, (GFunc)(&g_free), NULL);
./codenav/src/switch_head_impl.c:
g_slist_foreach(lang->impl_extensions, (GFunc)(&g_free), NULL);
./codenav/src/switch_head_impl.c:
g_slist_foreach(filenames_to_test, (GFunc)(&g_free), NULL);
./geanyprj/src/project.c: g_slist_foreach(lst, (GFunc) g_free, NULL);
./geanyprj/src/sidebar.c: g_slist_foreach(files, (GFunc)g_free, NULL);
/* free filenames */
./geanyprj/src/sidebar.c: g_slist_foreach(lst, (GFunc) g_free, NULL);
./latex/src/latex.c: g_slist_foreach(file_list, (GFunc) g_free,
NULL);
./latex/src/templates.c: g_slist_foreach(file_list, (GFunc) g_free,
NULL);
./projectorganizer/src/prjorg-project.c: g_slist_foreach(lst, (GFunc)
g_free, NULL);
./projectorganizer/src/prjorg-sidebar.c: g_slist_foreach(lst, (GFunc)
g_free, NULL);
./projectorganizer/src/prjorg-utils.c: g_slist_foreach(list,
(GFunc) g_free, NULL);
```
The strange thing is ProjectOrganizer uses both?
```
./src/prjorg-project.c: g_slist_free_full(children, g_free);
```
This type of code could be eliminated altogether (also from
./src/prjorg-project.c)
```
static void clear_idle_queue(GSList **queue)
{
GSList *elem;
foreach_slist(elem, *queue)
g_free(elem->data);
g_slist_free(*queue);
*queue = NULL;
}
g_slist_foreach(lst, (GFunc) g_free, NULL);
g_slist_free(lst);
g_slist_foreach(pattern_list, (GFunc) g_pattern_spec_free, NULL);
g_slist_free(pattern_list);
g_slist_foreach(ignored_dirs_list, (GFunc) g_pattern_spec_free, NULL);
g_slist_free(ignored_dirs_list);
g_slist_foreach(ignored_file_list, (GFunc) g_pattern_spec_free, NULL);
g_slist_free(ignored_file_list);
```
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1588
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany-plugins/issues/[email protected]>