X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=decoder.c;h=753a88ae12433e79fdd7792817f3d3023fd76df9;hb=d8d409590ce21116d85800c0eb8be287817a0eed;hp=95f3ac5dafde6fa0cf8c6d75a10a9c3d26e90288;hpb=f6c7eade2b8853b3d525b5cc0402e89ca74c1908;p=libsigrokdecode.git
diff --git a/decoder.c b/decoder.c
index 95f3ac5..753a88a 100644
--- a/decoder.c
+++ b/decoder.c
@@ -18,7 +18,7 @@
* along with this program. If not, see .
*/
-#include "config.h"
+#include
#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
#include "libsigrokdecode.h"
#include
@@ -66,7 +66,7 @@ static gboolean srd_check_init(void)
/**
* Returns the list of supported/loaded protocol decoders.
*
- * This is a GSList containing the names of the decoders as strings.
+ * This is a GSList of pointers to struct srd_decoder items.
*
* @return List of decoders, NULL if none are supported or loaded.
*
@@ -132,11 +132,7 @@ static int get_channels(const struct srd_decoder *d, const char *attr,
break;
}
- if (!(pdch = g_try_malloc(sizeof(struct srd_channel)))) {
- srd_err("Failed to g_malloc() struct srd_channel.");
- ret = SRD_ERR_MALLOC;
- break;
- }
+ pdch = g_malloc(sizeof(struct srd_channel));
if ((py_dictitem_as_str(py_entry, "id", &pdch->id)) != SRD_OK) {
ret = SRD_ERR_PYTHON;
@@ -191,8 +187,8 @@ static int get_options(struct srd_decoder *d)
return SRD_ERR_PYTHON;
}
if (!(py_val = PyDict_GetItemString(py_opt, "id"))) {
- srd_err("Protocol decoder %s option %d has no "
- "id.", d->name);
+ srd_err("Protocol decoder %s option %zd has no "
+ "id.", d->name, opt);
return SRD_ERR_PYTHON;
}
o = g_malloc0(sizeof(struct srd_decoder_option));
@@ -331,11 +327,7 @@ SRD_API int srd_decoder_load(const char *module_name)
py_basedec = py_method = py_attr = NULL;
- if (!(d = g_try_malloc0(sizeof(struct srd_decoder)))) {
- srd_dbg("Failed to g_malloc() struct srd_decoder.");
- ret = SRD_ERR_MALLOC;
- goto err_out;
- }
+ d = g_malloc0(sizeof(struct srd_decoder));
ret = SRD_ERR_PYTHON;
@@ -367,7 +359,7 @@ SRD_API int srd_decoder_load(const char *module_name)
Py_CLEAR(py_basedec);
/*
- * Check that thÑs decoder has the correct PD API version.
+ * Check that this decoder has the correct PD API version.
* PDs of different API versions are incompatible and cannot work.
*/
py_long = PyObject_GetAttrString(d->py_dec, "api_version");