srd_exit(): Fix a -Wcast-function-type compiler warning.
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 30 Aug 2018 18:46:43 +0000 (20:46 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 30 Aug 2018 20:21:03 +0000 (22:21 +0200)
  srd.c: In function ‘srd_exit’:
  srd.c:310:28: warning: cast between incompatible function types from ‘int (*)(struct srd_session *)’ to ‘void (*)(void *, void *)’ [-Wcast-function-type]
    g_slist_foreach(sessions, (GFunc)srd_session_destroy, NULL);
                              ^

srd.c

diff --git a/srd.c b/srd.c
index d4ec44beca2a4579d7f3e7054f9095093ce40dd3..5903c6d7e75b748149218ffa459323f5d8ae804b 100644 (file)
--- a/srd.c
+++ b/srd.c
@@ -307,7 +307,8 @@ SRD_API int srd_exit(void)
 {
        srd_dbg("Exiting libsigrokdecode.");
 
-       g_slist_foreach(sessions, (GFunc)srd_session_destroy, NULL);
+       for (GSList *l = sessions; l; l = l->next)
+               srd_session_destroy(l->data);
 
        srd_decoder_unload_all();
        g_slist_free_full(searchpaths, g_free);