Old versions triggered valgrind errors as the API method to remove an
entry modifies the list that was being iterated.
Signed-off-by: Karl Palsson <redacted>
*/
SRD_API int srd_decoder_unload_all(void)
{
- GSList *l;
- struct srd_decoder *dec;
-
- for (l = pd_list; l; l = l->next) {
- dec = l->data;
- srd_decoder_unload(dec);
- }
+ g_slist_foreach(pd_list, (GFunc)srd_decoder_unload, NULL);
g_slist_free(pd_list);
pd_list = NULL;
*/
SRD_API int srd_exit(void)
{
- GSList *l;
-
srd_dbg("Exiting libsigrokdecode.");
- for (l = sessions; l; l = l->next)
- srd_session_destroy((struct srd_session *)l->data);
+ g_slist_foreach(sessions, (GFunc)srd_session_destroy, NULL);
srd_decoder_unload_all();
g_slist_free_full(searchpaths, g_free);