log: Use human-readable output type name everywhere.
authorUwe Hermann <uwe@hermann-uwe.de>
Fri, 12 Oct 2018 23:02:30 +0000 (01:02 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 13 Oct 2018 00:17:06 +0000 (02:17 +0200)
libsigrokdecode-internal.h
session.c
type_decoder.c

index 1d0931e0715df2bac1fdf3ada2a2b8fd6e064c0a..d5a34a2536ecfea1d2c7ed77a360fa8330060262 100644 (file)
@@ -108,6 +108,7 @@ SRD_PRIV long srd_decoder_apiver(const struct srd_decoder *d);
 
 /* type_decoder.c */
 SRD_PRIV PyObject *srd_Decoder_type_new(void);
+SRD_PRIV const char *output_type_name(unsigned int idx);
 
 /* type_logic.c */
 SRD_PRIV PyObject *srd_logic_type_new(void);
index 36b5005cc30d2aa4b8c4d322704fdf7079807180..73fdc080b11e5107fc20f71b228bed887303b259 100644 (file)
--- a/session.c
+++ b/session.c
@@ -372,7 +372,8 @@ SRD_API int srd_pd_output_callback_add(struct srd_session *sess,
        if (!sess)
                return SRD_ERR_ARG;
 
-       srd_dbg("Registering new callback for output type %d.", output_type);
+       srd_dbg("Registering new callback for output type %s.",
+               output_type_name(output_type));
 
        pd_cb = g_malloc(sizeof(struct srd_pd_callback));
        pd_cb->output_type = output_type;
index b90bdea04686219355fe382ba7796ff8867d6ea5..2ce7fc15740a74573f52d2a33e57be51ee9c4919 100644 (file)
@@ -31,7 +31,7 @@ typedef struct {
 } srd_Decoder;
 
 /* This is only used for nicer srd_dbg() output. */
-static const char *output_type_name(unsigned int idx)
+SRD_PRIV const char *output_type_name(unsigned int idx)
 {
        static const char names[][16] = {
                "OUTPUT_ANN",
@@ -519,8 +519,8 @@ static PyObject *Decoder_register(PyObject *self, PyObject *args,
                return py_new_output_id;
        }
 
-       srd_dbg("Instance %s creating new output type %d for %s.",
-               di->inst_id, output_type, proto_id);
+       srd_dbg("Instance %s creating new output type %s for %s.",
+               di->inst_id, output_type_name(output_type), proto_id);
 
        pdo = g_malloc(sizeof(struct srd_pd_output));