summaryrefslogtreecommitdiff
path: root/type_decoder.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2018-05-18 00:01:05 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2018-05-18 00:01:05 +0200
commit7969d8035530d40753c4f880c90a4e90f9679ccc (patch)
treeb749d364c36c1dd457e1869508c3cea8792ae002 /type_decoder.c
parent4e7ccaf9f133106786fd85a432ae23e11d9dcea2 (diff)
downloadlibsigrokdecode-7969d8035530d40753c4f880c90a4e90f9679ccc.tar.gz
libsigrokdecode-7969d8035530d40753c4f880c90a4e90f9679ccc.zip
Random whitespace/cosmetic/consistency fixes.
Diffstat (limited to 'type_decoder.c')
-rw-r--r--type_decoder.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/type_decoder.c b/type_decoder.c
index e69b3c4..2f15ee6 100644
--- a/type_decoder.c
+++ b/type_decoder.c
@@ -26,8 +26,7 @@ typedef struct {
PyObject_HEAD
} srd_Decoder;
-/* This is only used for nicer srd_dbg() output.
- */
+/* This is only used for nicer srd_dbg() output. */
static const char *output_type_name(unsigned int idx)
{
static const char names[][16] = {
@@ -37,6 +36,7 @@ static const char *output_type_name(unsigned int idx)
"OUTPUT_META",
"(invalid)"
};
+
return names[MIN(idx, G_N_ELEMENTS(names) - 1)];
}
@@ -332,8 +332,10 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
Py_XDECREF(py_res);
}
if ((cb = srd_pd_output_callback_find(di->sess, pdo->output_type))) {
- /* Frontends aren't really supposed to get Python
- * callbacks, but it's useful for testing. */
+ /*
+ * Frontends aren't really supposed to get Python
+ * callbacks, but it's useful for testing.
+ */
pdata.data = py_data;
cb->cb(&pdata, cb->cb_data);
}
@@ -390,7 +392,7 @@ static PyObject *Decoder_register(PyObject *self, PyObject *args,
const GVariantType *meta_type_gv;
int output_type;
char *proto_id, *meta_name, *meta_descr;
- char *keywords[] = {"output_type", "proto_id", "meta", NULL};
+ char *keywords[] = { "output_type", "proto_id", "meta", NULL };
PyGILState_STATE gstate;
gboolean is_meta;
GSList *l;
@@ -407,7 +409,7 @@ static PyObject *Decoder_register(PyObject *self, PyObject *args,
goto err;
}
- /* Default to instance id, which defaults to class id. */
+ /* Default to instance ID, which defaults to class ID. */
proto_id = di->inst_id;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|s(Oss)", keywords,
&output_type, &proto_id,
@@ -957,14 +959,14 @@ err:
}
static PyMethodDef Decoder_methods[] = {
- {"put", Decoder_put, METH_VARARGS,
- "Accepts a dictionary with the following keys: startsample, endsample, data"},
- {"register", (PyCFunction)Decoder_register, METH_VARARGS|METH_KEYWORDS,
- "Register a new output stream"},
- {"wait", Decoder_wait, METH_VARARGS,
- "Wait for one or more conditions to occur"},
- {"has_channel", Decoder_has_channel, METH_VARARGS,
- "Report whether a channel was supplied"},
+ { "put", Decoder_put, METH_VARARGS,
+ "Accepts a dictionary with the following keys: startsample, endsample, data" },
+ { "register", (PyCFunction)Decoder_register, METH_VARARGS|METH_KEYWORDS,
+ "Register a new output stream" },
+ { "wait", Decoder_wait, METH_VARARGS,
+ "Wait for one or more conditions to occur" },
+ { "has_channel", Decoder_has_channel, METH_VARARGS,
+ "Report whether a channel was supplied" },
{NULL, NULL, 0, NULL}
};