]> sigrok.org Git - libsigrokdecode.git/blobdiff - controller.c
srd: s/python/Python/.
[libsigrokdecode.git] / controller.c
index 476f4f3aaf6b0e613d6a560f446302f6b5c4cb07..6a0aa2ada157d303fa328c8b3d634f9be2fa81a3 100644 (file)
@@ -71,7 +71,7 @@ SRD_API int srd_init(void)
        /* Add our own module to the list of built-in modules. */
        PyImport_AppendInittab("sigrokdecode", PyInit_sigrokdecode);
 
-       /* Initialize the python interpreter. */
+       /* Initialize the Python interpreter. */
        Py_Initialize();
 
        if ((ret = set_modulepath()) != SRD_OK) {
@@ -317,7 +317,7 @@ SRD_API int srd_instance_set_probes(struct srd_decoder_instance *di,
        new_probemap = NULL;
 
        if (!(new_probemap = g_try_malloc(sizeof(int) * di->dec_num_probes))) {
-               srd_err("Failed to malloc new probe map.");
+               srd_err("Failed to g_malloc() new probe map.");
                return SRD_ERR_MALLOC;
        }
 
@@ -378,8 +378,8 @@ SRD_API struct srd_decoder_instance *srd_instance_new(const char *decoder_id,
                return NULL;
        }
 
-       if (!(di = g_try_malloc0(sizeof(*di)))) {
-               srd_err("Failed to malloc instance.");
+       if (!(di = g_try_malloc0(sizeof(struct srd_decoder_instance)))) {
+               srd_err("Failed to g_malloc() instance.");
                return NULL;
        }
 
@@ -396,7 +396,7 @@ SRD_API struct srd_decoder_instance *srd_instance_new(const char *decoder_id,
        if (di->dec_num_probes) {
                if (!(di->dec_probemap =
                     g_try_malloc(sizeof(int) * di->dec_num_probes))) {
-                       srd_err("Failed to malloc probe map.");
+                       srd_err("Failed to g_malloc() probe map.");
                        g_free(di);
                        return NULL;
                }
@@ -472,14 +472,14 @@ SRD_API struct srd_decoder_instance *srd_instance_find_by_id(char *instance_id)
 }
 
 /**
- * Finds a decoder instance by its python object, i.e. that instance's
+ * Finds a decoder instance by its Python object, i.e. that instance's
  * instantiation of the sigrokdecode.Decoder class. This will recurse
  * to find the instance anywhere in the stack tree.
  *
  * @param stack Pointer to a GSList of struct srd_decoder_instance,
  *             indicating the stack to search. To start searching at the bottom
  *             level of decoder instances, pass NULL.
- * @param obj The python class instantiation.
+ * @param obj The Python class instantiation.
  *
  * @return Pointer to struct srd_decoder_instance, or NULL if not found.
  */
@@ -511,7 +511,7 @@ SRD_API int srd_instance_start(struct srd_decoder_instance *di, PyObject *args)
                di->instance_id);
 
        if (!(py_name = PyUnicode_FromString("start"))) {
-               srd_err("Unable to build python object for 'start'.");
+               srd_err("Unable to build Python object for 'start'.");
                catch_exception("Protocol decoder instance %s: ",
                                di->instance_id);
                return SRD_ERR_PYTHON;
@@ -653,7 +653,7 @@ SRD_API int srd_session_start(int num_probes, int unitsize, uint64_t samplerate)
         * samplerate. This can be extended as needed.
         */
        if (!(args = Py_BuildValue("{s:l}", "samplerate", (long)samplerate))) {
-               srd_err("Unable to build python object for metadata.");
+               srd_err("Unable to build Python object for metadata.");
                return SRD_ERR_PYTHON;
        }
 
@@ -698,8 +698,10 @@ SRD_API int srd_register_callback(int output_type, srd_pd_output_callback_t cb)
 
        srd_dbg("Registering new callback for output type %d.", output_type);
 
-       if (!(pd_cb = g_try_malloc(sizeof(struct srd_pd_callback))))
+       if (!(pd_cb = g_try_malloc(sizeof(struct srd_pd_callback)))) {
+               srd_err("Failed to g_malloc() struct srd_pd_callback.");
                return SRD_ERR_MALLOC;
+       }
 
        pd_cb->output_type = output_type;
        pd_cb->callback = cb;
@@ -726,7 +728,7 @@ SRD_API void *srd_find_callback(int output_type)
        return cb;
 }
 
-/* This is the backend function to python sigrokdecode.add() call. */
+/* This is the backend function to Python sigrokdecode.add() call. */
 SRD_PRIV int pd_add(struct srd_decoder_instance *di, int output_type,
                    char *proto_id)
 {
@@ -735,8 +737,10 @@ SRD_PRIV int pd_add(struct srd_decoder_instance *di, int output_type,
        srd_dbg("Instance %s creating new output type %d for %s.",
                di->instance_id, output_type, proto_id);
 
-       if (!(pdo = g_try_malloc(sizeof(struct srd_pd_output))))
+       if (!(pdo = g_try_malloc(sizeof(struct srd_pd_output)))) {
+               srd_err("Failed to g_malloc() struct srd_pd_output.");
                return -1;
+       }
 
        /* pdo_id is just a simple index, nothing is deleted from this list anyway. */
        pdo->pdo_id = g_slist_length(di->pd_output);