diff options
-rw-r--r-- | controller.c | 15 | ||||
-rw-r--r-- | libsigrokdecode-internal.h | 2 | ||||
-rw-r--r-- | type_decoder.c | 4 |
3 files changed, 10 insertions, 11 deletions
diff --git a/controller.c b/controller.c index 7987ea1..9267ded 100644 --- a/controller.c +++ b/controller.c @@ -965,22 +965,21 @@ SRD_API int srd_pd_output_callback_add(int output_type, } /** @private */ -SRD_PRIV void *srd_pd_output_callback_find(int output_type) +SRD_PRIV struct srd_pd_callback *srd_pd_output_callback_find(int output_type) { GSList *l; - struct srd_pd_callback *pd_cb; - void *(cb); + struct srd_pd_callback *tmp, *pd_cb; - cb = NULL; + pd_cb = NULL; for (l = callbacks; l; l = l->next) { - pd_cb = l->data; - if (pd_cb->output_type == output_type) { - cb = pd_cb->cb; + tmp = l->data; + if (tmp->output_type == output_type) { + pd_cb = tmp; break; } } - return cb; + return pd_cb; } /* This is the backend function to Python sigrokdecode.add() call. */ diff --git a/libsigrokdecode-internal.h b/libsigrokdecode-internal.h index 10b7fa7..600b9fd 100644 --- a/libsigrokdecode-internal.h +++ b/libsigrokdecode-internal.h @@ -35,7 +35,7 @@ SRD_PRIV int srd_inst_decode(uint64_t start_samplenum, const uint8_t *inbuf, uint64_t inbuflen); SRD_PRIV void srd_inst_free(struct srd_decoder_inst *di); SRD_PRIV void srd_inst_free_all(GSList *stack); -SRD_PRIV void *srd_pd_output_callback_find(int output_type); +SRD_PRIV struct srd_pd_callback *srd_pd_output_callback_find(int output_type); SRD_PRIV int srd_inst_pd_output_add(struct srd_decoder_inst *di, int output_type, const char *output_id); diff --git a/type_decoder.c b/type_decoder.c index 16675bc..3f4bae9 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -95,7 +95,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) struct srd_proto_data *pdata; uint64_t start_sample, end_sample; int output_id; - void (*cb)(); + struct srd_pd_callback *cb; if (!(di = srd_inst_find_by_obj(NULL, self))) { /* Shouldn't happen. */ @@ -142,7 +142,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) /* An error was already logged. */ break; } - cb(pdata); + cb->cb(pdata, cb->cb_data); } break; case SRD_OUTPUT_PROTO: |