X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoder.c;h=64292bc7077452abb45caba3de6b728546824f44;hb=e992ae3a525cbc0d6441bdf102dae347f1ccf6d0;hp=83b758f84a8f546496904b287fd40a5dfb524d0e;hpb=01b60707d7aa8db402c9288472c102da483cad39;p=libsigrokdecode.git diff --git a/decoder.c b/decoder.c index 83b758f..64292bc 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) { @@ -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"; @@ -767,8 +781,11 @@ SRD_API int srd_decoder_load(const char *module_name) return SRD_OK; except_out: - srd_exception_catch("Failed to load decoder %s: %s", - module_name, fail_txt); + /* Don't show a message for the "common" directory, it's not a PD. */ + if (strcmp(module_name, "common")) { + srd_exception_catch("Failed to load decoder %s: %s", + module_name, fail_txt); + } fail_txt = NULL; err_out: if (fail_txt)