extcap-base.c: fix compilation with gcc 8
authorPascal Quantin <pascal.quantin@gmail.com>
Wed, 2 May 2018 16:37:28 +0000 (18:37 +0200)
committerGuy Harris <guy@alum.mit.edu>
Wed, 2 May 2018 19:33:10 +0000 (19:33 +0000)
extcap-base.c:293:43: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
extcap-base.c:302:45: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
extcap-base.c:321:42: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]

Change-Id: Ifd9151d04412c5e29636dc14c57a327cc12d33f3
Reviewed-on: https://code.wireshark.org/review/27265
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
extcap/extcap-base.c

index 45713adfd6091711117cfa978d64ee9cc25cd9d8..40b87a557d287971543f12a775815017bd8099ad 100644 (file)
@@ -289,9 +289,7 @@ static void extcap_help_option_free(gpointer option)
 
 void extcap_base_cleanup(extcap_parameters ** extcap)
 {
-    /* g_list_free_full() only exists since 2.28. g_list_free_full((*extcap)->interfaces, extcap_iface_free);*/
-    g_list_foreach((*extcap)->interfaces, (GFunc)extcap_iface_free, NULL);
-    g_list_free((*extcap)->interfaces);
+    g_list_free_full((*extcap)->interfaces, extcap_iface_free);
     g_free((*extcap)->exename);
     g_free((*extcap)->fifo);
     g_free((*extcap)->interface);
@@ -299,13 +297,12 @@ void extcap_base_cleanup(extcap_parameters ** extcap)
     g_free((*extcap)->helppage);
     g_free((*extcap)->help_header);
     g_free((*extcap)->ws_version);
-    g_list_foreach((*extcap)->help_options, (GFunc)extcap_help_option_free, NULL);
-    g_list_free((*extcap)->help_options);
+    g_list_free_full((*extcap)->help_options, extcap_help_option_free);
     g_free(*extcap);
     *extcap = NULL;
 }
 
-static void extcap_print_option(gpointer option)
+static void extcap_print_option(gpointer option, gpointer user_data _U_)
 {
     extcap_option_t* o = (extcap_option_t*)option;
     printf("\t%s: %s\n", o->optname, o->optdesc);
@@ -318,7 +315,7 @@ void extcap_help_print(extcap_parameters * extcap)
     printf("%s", extcap->help_header);
     printf("\n");
     printf("Options:\n");
-    g_list_foreach(extcap->help_options, (GFunc)extcap_print_option, NULL);
+    g_list_foreach(extcap->help_options, extcap_print_option, NULL);
     printf("\n");
 }