summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2018-08-15 23:09:11 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2018-08-30 22:14:27 +0200
commitc7b211b18466c69df976a6d71f1c8ba30145f14c (patch)
treedfd8359beaff7a4bdb9a6c7bcd1a45414df3a4a9 /log.c
parentd4d8ac2a005a091f23bf89cff2ff6fbfc8fcd739 (diff)
downloadlibsigrokdecode-c7b211b18466c69df976a6d71f1c8ba30145f14c.tar.gz
libsigrokdecode-c7b211b18466c69df976a6d71f1c8ba30145f14c.zip
log: add a public srd_log_callback_get() API routine
Allow applications to query the currently registered log callback. So they can either restore the previously registered routine, or register another routine _and_ log to the previously registered routine as well.
Diffstat (limited to 'log.c')
-rw-r--r--log.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/log.c b/log.c
index 459a5c1..b5402f8 100644
--- a/log.c
+++ b/log.c
@@ -130,6 +130,28 @@ SRD_API int srd_log_callback_set(srd_log_callback cb, void *cb_data)
}
/**
+ * Get the libsigrokdecode log callback routine and callback data.
+ *
+ * @param[out] cb Pointer to a function pointer to receive the log callback
+ * function. Optional, can be NULL.
+ * @param[out] cb_data Pointer to a void pointer to receive the log callback's
+ * additional arguments. Optional, can be NULL.
+ *
+ * @return SRD_OK upon success.
+ *
+ * @since 0.6.0
+ */
+SRD_API int srd_log_callback_get(srd_log_callback *cb, void **cb_data)
+{
+ if (cb)
+ *cb = srd_log_cb;
+ if (cb_data)
+ *cb_data = srd_log_cb_data;
+
+ return SRD_OK;
+}
+
+/**
* Set the libsigrokdecode log callback to the default built-in one.
*
* Additionally, the internal 'srd_log_cb_data' pointer is set to NULL.