]> sigrok.org Git - libsigrokdecode.git/blobdiff - controller.c
Use frontend-registered callback with correct parameters
[libsigrokdecode.git] / controller.c
index 2f766651864c2a34f8691797a2beb15b01da0246..9267ded40e653a14423c9446b23f8994e5366542 100644 (file)
@@ -403,6 +403,7 @@ SRD_API int srd_inst_option_set(struct srd_decoder_inst *di,
                if (PyDict_SetItemString(py_di_options, key, py_optval) == -1)
                        goto err_out;
                g_free(key);
+               key = NULL;
        }
 
        ret = SRD_OK;
@@ -964,22 +965,21 @@ SRD_API int srd_pd_output_callback_add(int output_type,
 }
 
 /** @private */
-SRD_PRIV void *srd_pd_output_callback_find(int output_type)
+SRD_PRIV struct srd_pd_callback *srd_pd_output_callback_find(int output_type)
 {
        GSList *l;
-       struct srd_pd_callback *pd_cb;
-       void *(cb);
+       struct srd_pd_callback *tmp, *pd_cb;
 
-       cb = NULL;
+       pd_cb = NULL;
        for (l = callbacks; l; l = l->next) {
-               pd_cb = l->data;
-               if (pd_cb->output_type == output_type) {
-                       cb = pd_cb->cb;
+               tmp = l->data;
+               if (tmp->output_type == output_type) {
+                       pd_cb = tmp;
                        break;
                }
        }
 
-       return cb;
+       return pd_cb;
 }
 
 /* This is the backend function to Python sigrokdecode.add() call. */