X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoder.c;h=6290add071b64865cb36c9a392d15e7da6440d1f;hp=d7780d5b8e5d0d6fe086a27ce363c7011e4d1a9e;hb=4b442477602ef5938c4826925e21f38c8f1e13a9;hpb=8ad6e500312084cd4ae43c7bda476cc7370cda20 diff --git a/decoder.c b/decoder.c index d7780d5..6290add 100644 --- a/decoder.c +++ b/decoder.c @@ -62,7 +62,8 @@ SRD_API struct srd_decoder *srd_decoder_get_by_id(const char *id) return NULL; } -static int get_probes(struct srd_decoder *d, char *attr, GSList **pl) +static int get_probes(const struct srd_decoder *d, const char *attr, + GSList **pl) { PyObject *py_probelist, *py_entry; struct srd_probe *p; @@ -148,7 +149,7 @@ SRD_API int srd_decoder_load(const char *module_name) /* Import the Python module. */ if (!(d->py_mod = PyImport_ImportModule(module_name))) { - catch_exception("Import of '%s' failed.", module_name); + srd_exception_catch("Import of '%s' failed.", module_name); goto err_out; } @@ -237,10 +238,6 @@ SRD_API int srd_decoder_load(const char *module_name) if (py_attr_as_str(d->py_dec, "license", &(d->license)) != SRD_OK) goto err_out; - /* TODO: Handle inputformats, outputformats. */ - d->inputformats = NULL; - d->outputformats = NULL; - /* Convert class annotation attribute to GSList of **char. */ d->annotations = NULL; if (PyObject_HasAttrString(d->py_dec, "annotations")) { @@ -292,7 +289,7 @@ err_out: * @return A newly allocated buffer containing the protocol decoder's * documentation. The caller is responsible for free'ing the buffer. */ -SRD_API char *srd_decoder_doc(const struct srd_decoder *dec) +SRD_API char *srd_decoder_doc_get(const struct srd_decoder *dec) { PyObject *py_str; char *doc; @@ -301,7 +298,7 @@ SRD_API char *srd_decoder_doc(const struct srd_decoder *dec) return NULL; if (!(py_str = PyObject_GetAttrString(dec->py_mod, "__doc__"))) { - catch_exception(""); + srd_exception_catch(""); return NULL; } @@ -358,12 +355,6 @@ SRD_API int srd_decoder_unload(struct srd_decoder *dec) g_free(dec->desc); g_free(dec->license); - /* TODO: Free everything in inputformats and outputformats. */ - if (dec->inputformats != NULL) - g_slist_free(dec->inputformats); - if (dec->outputformats != NULL) - g_slist_free(dec->outputformats); - /* The module's Decoder class. */ Py_XDECREF(dec->py_dec); /* The module itself. */