From: Uwe Hermann Date: Sat, 3 May 2014 20:45:50 +0000 (+0200) Subject: Don't define names ending with _t (POSIX reserved). X-Git-Tag: libsigrokdecode-0.3.0~21 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2372b1998ae5d252433d7a7a07744ba2ea81b96e;p=libsigrokdecode.git Don't define names ending with _t (POSIX reserved). Avoid defining any names ending in _t, those are generally reserved for POSIX usage. For details see: http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html --- diff --git a/libsigrokdecode.h b/libsigrokdecode.h index 4476f79..db06d43 100644 --- a/libsigrokdecode.h +++ b/libsigrokdecode.h @@ -258,12 +258,12 @@ struct srd_proto_data_binary { const unsigned char *data; }; -typedef void (*srd_pd_output_callback_t)(struct srd_proto_data *pdata, - void *cb_data); +typedef void (*srd_pd_output_callback)(struct srd_proto_data *pdata, + void *cb_data); struct srd_pd_callback { int output_type; - srd_pd_output_callback_t cb; + srd_pd_output_callback cb; void *cb_data; }; @@ -298,7 +298,7 @@ SRD_API int srd_session_send(struct srd_session *sess, const uint8_t *inbuf, uint64_t inbuflen); SRD_API int srd_session_destroy(struct srd_session *sess); SRD_API int srd_pd_output_callback_add(struct srd_session *sess, - int output_type, srd_pd_output_callback_t cb, void *cb_data); + int output_type, srd_pd_output_callback cb, void *cb_data); /* decoder.c */ SRD_API const GSList *srd_decoder_list(void); @@ -322,11 +322,11 @@ SRD_API struct srd_decoder_inst *srd_inst_find_by_id(struct srd_session *sess, const char *inst_id); /* log.c */ -typedef int (*srd_log_callback_t)(void *cb_data, int loglevel, +typedef int (*srd_log_callback)(void *cb_data, int loglevel, const char *format, va_list args); SRD_API int srd_log_loglevel_set(int loglevel); SRD_API int srd_log_loglevel_get(void); -SRD_API int srd_log_callback_set(srd_log_callback_t cb, void *cb_data); +SRD_API int srd_log_callback_set(srd_log_callback cb, void *cb_data); SRD_API int srd_log_callback_set_default(void); SRD_API int srd_log_logdomain_set(const char *logdomain); SRD_API char *srd_log_logdomain_get(void); diff --git a/log.c b/log.c index 46fa9e5..a5ca214 100644 --- a/log.c +++ b/log.c @@ -45,13 +45,13 @@ static int srd_logv(void *cb_data, int loglevel, const char *format, va_list args); /* Pointer to the currently selected log callback. Default: srd_logv(). */ -static srd_log_callback_t srd_log_callback = srd_logv; +static srd_log_callback srd_log_cb = srd_logv; /* * Pointer to private data that can be passed to the log callback. * This can be used (for example) by C++ GUIs to pass a "this" pointer. */ -static void *srd_log_callback_data = NULL; +static void *srd_log_cb_data = NULL; /* Log domain (a short string that is used as prefix for all messages). */ /** @cond PRIVATE */ @@ -164,7 +164,7 @@ SRD_API char *srd_log_logdomain_get(void) * * @since 0.1.0 */ -SRD_API int srd_log_callback_set(srd_log_callback_t cb, void *cb_data) +SRD_API int srd_log_callback_set(srd_log_callback cb, void *cb_data) { if (!cb) { srd_err("log: %s: cb was NULL", __func__); @@ -173,8 +173,8 @@ SRD_API int srd_log_callback_set(srd_log_callback_t cb, void *cb_data) /* Note: 'cb_data' is allowed to be NULL. */ - srd_log_callback = cb; - srd_log_callback_data = cb_data; + srd_log_cb = cb; + srd_log_cb_data = cb_data; return SRD_OK; } @@ -182,7 +182,7 @@ SRD_API int srd_log_callback_set(srd_log_callback_t cb, void *cb_data) /** * Set the libsigrokdecode log callback to the default built-in one. * - * Additionally, the internal 'srd_log_callback_data' pointer is set to NULL. + * Additionally, the internal 'srd_log_cb_data' pointer is set to NULL. * * @return SRD_OK upon success, a (negative) error code otherwise. * @@ -194,8 +194,8 @@ SRD_API int srd_log_callback_set_default(void) * Note: No log output in this function, as it should safely work * even if the currently set log callback is buggy/broken. */ - srd_log_callback = srd_logv; - srd_log_callback_data = NULL; + srd_log_cb = srd_logv; + srd_log_cb_data = NULL; return SRD_OK; } @@ -227,7 +227,7 @@ SRD_PRIV int srd_log(int loglevel, const char *format, ...) va_list args; va_start(args, format); - ret = srd_log_callback(srd_log_callback_data, loglevel, format, args); + ret = srd_log_cb(srd_log_cb_data, loglevel, format, args); va_end(args); return ret; @@ -240,8 +240,7 @@ SRD_PRIV int srd_spew(const char *format, ...) va_list args; va_start(args, format); - ret = srd_log_callback(srd_log_callback_data, SRD_LOG_SPEW, - format, args); + ret = srd_log_cb(srd_log_cb_data, SRD_LOG_SPEW, format, args); va_end(args); return ret; @@ -254,8 +253,7 @@ SRD_PRIV int srd_dbg(const char *format, ...) va_list args; va_start(args, format); - ret = srd_log_callback(srd_log_callback_data, SRD_LOG_DBG, - format, args); + ret = srd_log_cb(srd_log_cb_data, SRD_LOG_DBG, format, args); va_end(args); return ret; @@ -268,8 +266,7 @@ SRD_PRIV int srd_info(const char *format, ...) va_list args; va_start(args, format); - ret = srd_log_callback(srd_log_callback_data, SRD_LOG_INFO, - format, args); + ret = srd_log_cb(srd_log_cb_data, SRD_LOG_INFO, format, args); va_end(args); return ret; @@ -282,8 +279,7 @@ SRD_PRIV int srd_warn(const char *format, ...) va_list args; va_start(args, format); - ret = srd_log_callback(srd_log_callback_data, SRD_LOG_WARN, - format, args); + ret = srd_log_cb(srd_log_cb_data, SRD_LOG_WARN, format, args); va_end(args); return ret; @@ -296,8 +292,7 @@ SRD_PRIV int srd_err(const char *format, ...) va_list args; va_start(args, format); - ret = srd_log_callback(srd_log_callback_data, SRD_LOG_ERR, - format, args); + ret = srd_log_cb(srd_log_cb_data, SRD_LOG_ERR, format, args); va_end(args); return ret; diff --git a/session.c b/session.c index 48d7e46..2ab7462 100644 --- a/session.c +++ b/session.c @@ -301,7 +301,7 @@ SRD_API int srd_session_destroy(struct srd_session *sess) * @since 0.3.0 */ SRD_API int srd_pd_output_callback_add(struct srd_session *sess, - int output_type, srd_pd_output_callback_t cb, void *cb_data) + int output_type, srd_pd_output_callback cb, void *cb_data) { struct srd_pd_callback *pd_cb; diff --git a/tests/runtc.c b/tests/runtc.c index 25b4e38..cd3d449 100644 --- a/tests/runtc.c +++ b/tests/runtc.c @@ -327,7 +327,7 @@ static int run_testcase(char *infile, GSList *pdlist, struct output *op) struct srd_session *sess; struct srd_decoder *dec; struct srd_decoder_inst *di, *prev_di; - srd_pd_output_callback_t cb; + srd_pd_output_callback cb; struct pd *pd; struct channel *channel; struct option *option;