]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoder.c
x2444m: Move variable initializations to reset().
[libsigrokdecode.git] / decoder.c
index c195e4bd00710240f75733a34d04a939da694822..2eb9a573136cb206bffc4c30a052b2ebb9c76f49 100644 (file)
--- a/decoder.c
+++ b/decoder.c
@@ -751,6 +751,11 @@ SRD_API int srd_decoder_load(const char *module_name)
 
        /* Check Decoder class for required methods. */
 
+       if (check_method(d->py_dec, module_name, "reset") != SRD_OK) {
+               fail_txt = "no 'reset()' method";
+               goto err_out;
+       }
+
        if (check_method(d->py_dec, module_name, "start") != SRD_OK) {
                fail_txt = "no 'start()' method";
                goto err_out;
@@ -1068,6 +1073,13 @@ SRD_API int srd_decoder_load_all(void)
        return SRD_OK;
 }
 
+static void srd_decoder_unload_cb(void *arg, void *ignored)
+{
+       (void)ignored;
+
+       srd_decoder_unload((struct srd_decoder *)arg);
+}
+
 /**
  * Unload all loaded protocol decoders.
  *
@@ -1077,7 +1089,7 @@ SRD_API int srd_decoder_load_all(void)
  */
 SRD_API int srd_decoder_unload_all(void)
 {
-       g_slist_foreach(pd_list, (GFunc)srd_decoder_unload, NULL);
+       g_slist_foreach(pd_list, srd_decoder_unload_cb, NULL);
        g_slist_free(pd_list);
        pd_list = NULL;