]> sigrok.org Git - libsigrokdecode.git/blobdiff - controller.c
Code cleanup
[libsigrokdecode.git] / controller.c
index 2f766651864c2a34f8691797a2beb15b01da0246..276dc2dcc686cca61dbff2f914789fc08282f6cf 100644 (file)
@@ -98,7 +98,6 @@ static GSList *callbacks = NULL;
 extern SRD_PRIV GSList *pd_list;
 
 /* module_sigrokdecode.c */
-/* FIXME: SRD_PRIV causes issues on MinGW. Investigate. */
 extern PyMODINIT_FUNC PyInit_sigrokdecode(void);
 
 /* type_logic.c */
@@ -254,21 +253,6 @@ SRD_PRIV int srd_decoder_searchpath_add(const char *path)
        g_string_free(new_path, TRUE);
        g_free(wc_new_path);
 
-//#ifdef _WIN32
-//     gchar **splitted;
-//
-//     /*
-//      * On Windows/MinGW, Python's sys.path needs entries of the form
-//      * 'C:\\foo\\bar' instead of '/foo/bar'.
-//      */
-//
-//     splitted = g_strsplit(DECODERS_DIR, "/", 0);
-//     path = g_build_pathv("\\\\", splitted);
-//     g_strfreev(splitted);
-//#else
-//     path = g_strdup(DECODERS_DIR);
-//#endif
-
        return SRD_OK;
 }
 
@@ -403,6 +387,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 +949,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. */