Move some DIAG_OFFs to make code less ugly
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>
Tue, 26 Sep 2017 15:28:02 +0000 (16:28 +0100)
committerJoão Valverde <j@v6e.pt>
Tue, 26 Sep 2017 17:28:10 +0000 (17:28 +0000)
Change-Id: I0f343ab69a6592a466e12e5d258f0878b9c32c25
Reviewed-on: https://code.wireshark.org/review/23752
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
codecs/codecs.c
epan/proto.c
epan/tap.c
wiretap/wtap.c

index 45716931eff8ab0447f6c6f660f144d9665fd765..4e7eb60eddb8ea503cc2db14e7e69fc97df548c0 100644 (file)
@@ -59,6 +59,7 @@ static GSList *codec_plugins = NULL;
 /*
  * Callback for each plugin found.
  */
+DIAG_OFF(pedantic)
 static gboolean
 check_for_codec_plugin(GModule *handle)
 {
@@ -87,6 +88,7 @@ check_for_codec_plugin(GModule *handle)
     codec_plugins = g_slist_prepend(codec_plugins, plugin);
     return TRUE;
 }
+DIAG_ON(pedantic)
 
 void
 codec_register_plugin_types(void)
index c785733a1d6826a5a26ecad866a3b4a111fe14e9..1a99ba2c239d7e1e3c8851c14904c997f0b00fd7 100644 (file)
@@ -433,6 +433,7 @@ static GSList *dissector_plugins = NULL;
 /*
  * Callback for each plugin found.
  */
+DIAG_OFF(pedantic)
 static gboolean
 check_for_dissector_plugin(GModule *handle)
 {
@@ -445,9 +446,7 @@ check_for_dissector_plugin(GModule *handle)
         * Do we have a register routine?
         */
        if (g_module_symbol(handle, "plugin_register", &gp)) {
-DIAG_OFF(pedantic)
                register_protoinfo = (void (*)(void))gp;
-DIAG_ON(pedantic)
        }
        else {
                register_protoinfo = NULL;
@@ -457,9 +456,7 @@ DIAG_ON(pedantic)
         * Do we have a reg_handoff routine?
         */
        if (g_module_symbol(handle, "plugin_reg_handoff", &gp)) {
-DIAG_OFF(pedantic)
                reg_handoff = (void (*)(void))gp;
-DIAG_ON(pedantic)
        }
        else {
                reg_handoff = NULL;
@@ -480,6 +477,7 @@ DIAG_ON(pedantic)
        dissector_plugins = g_slist_prepend(dissector_plugins, plugin);
        return TRUE;
 }
+DIAG_ON(pedantic)
 
 static void
 register_dissector_plugin(gpointer data, gpointer user_data _U_)
index 44ab2fc2a74761b762898bf02da4768e34f5f5ea..4760a3b302eb4302fbc508dc077ed375706b4f50 100644 (file)
@@ -125,6 +125,7 @@ static GSList *tap_plugins = NULL;
 /*
  * Callback for each plugin found.
  */
+DIAG_OFF(pedantic)
 static gboolean
 check_for_tap_plugin(GModule *handle)
 {
@@ -143,9 +144,7 @@ check_for_tap_plugin(GModule *handle)
        /*
         * Yes - this plugin includes one or more taps.
         */
-DIAG_OFF(pedantic)
        register_tap_listener_fn = (void (*)(void))gp;
-DIAG_ON(pedantic)
 
        /*
         * Add this one to the list of tap plugins.
@@ -155,6 +154,7 @@ DIAG_ON(pedantic)
        tap_plugins = g_slist_prepend(tap_plugins, plugin);
        return TRUE;
 }
+DIAG_ON(pedantic)
 
 void
 register_tap_plugin_type(void)
index 64c10156ebe5457b7cc18de011dd4b77ebf2ce00..4354600f9dddde66a659e3cf15f6b96a5617a01b 100644 (file)
@@ -51,10 +51,12 @@ static GSList *wtap_plugins = NULL;
 /*
  * Callback for each plugin found.
  */
+DIAG_OFF(pedantic)
 static gboolean
 check_for_wtap_plugin(GModule *handle)
 {
        gpointer gp;
+       void (*register_wtap_module)(void);
        wtap_plugin *plugin;
 
        /*
@@ -67,15 +69,18 @@ check_for_wtap_plugin(GModule *handle)
 
        /*
         * Yes - this plugin includes one or more wiretap modules.
+        */
+       register_wtap_module = (void (*)(void))gp;
+
+       /*
         * Add this one to the list of wiretap module plugins.
         */
        plugin = (wtap_plugin *)g_malloc(sizeof (wtap_plugin));
-DIAG_OFF(pedantic)
-       plugin->register_wtap_module = (void (*)(void))gp;
-DIAG_ON(pedantic)
+       plugin->register_wtap_module = register_wtap_module;
        wtap_plugins = g_slist_prepend(wtap_plugins, plugin);
        return TRUE;
 }
+DIAG_ON(pedantic)
 
 static void
 wtap_register_plugin_types(void)