X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoder.c;h=d7395a679eb3d0bac8d9d91a2073cadd4490a1f9;hp=9990e2998e14bdfff730d05170f39e7c078fa277;hb=eb88372396c2264948bc05586fb54dc318266973;hpb=e51475add18d4a6ee4e30c4c5891b6de64c7c148 diff --git a/decoder.c b/decoder.c index 9990e29..d7395a6 100644 --- a/decoder.c +++ b/decoder.c @@ -165,6 +165,8 @@ static void decoder_free(struct srd_decoder *dec) g_slist_free_full(dec->opt_channels, &channel_free); g_slist_free_full(dec->channels, &channel_free); + g_slist_free_full(dec->outputs, g_free); + g_slist_free_full(dec->inputs, g_free); g_free(dec->license); g_free(dec->desc); g_free(dec->longname); @@ -592,6 +594,8 @@ static int check_method(PyObject *py_dec, const char *mod_name, * @param d The decoder to use. Must not be NULL. * * @return The API version of the decoder, or 0 upon errors. + * + * @private */ SRD_PRIV long srd_decoder_apiver(const struct srd_decoder *d) { @@ -682,8 +686,8 @@ SRD_API int srd_decoder_load(const char *module_name) * PDs of different API versions are incompatible and cannot work. */ apiver = srd_decoder_apiver(d); - if (apiver != 2 && apiver != 3) { - srd_exception_catch("Only PD API version 2/3 is supported, " + if (apiver != 3) { + srd_exception_catch("Only PD API version 3 is supported, " "decoder %s has version %ld", module_name, apiver); fail_txt = "API version mismatch"; goto err_out; @@ -727,6 +731,16 @@ SRD_API int srd_decoder_load(const char *module_name) goto err_out; } + if (py_attr_as_strlist(d->py_dec, "inputs", &(d->inputs)) != SRD_OK) { + fail_txt = "missing or malformed 'inputs' attribute"; + goto err_out; + } + + if (py_attr_as_strlist(d->py_dec, "outputs", &(d->outputs)) != SRD_OK) { + fail_txt = "missing or malformed 'outputs' attribute"; + goto err_out; + } + /* All options and their default values. */ if (get_options(d) != SRD_OK) { fail_txt = "cannot get options";