summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-13 03:00:51 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 11:58:04 -0800
commitf59ec2043b840a4534fdd61502de59e2571988d5 (patch)
treefe402dde3d553558dbb4505ecca4f8d6528f7451
parent99b57b6dccec1059f746121b9b9ddb11313f708b (diff)
downloadopenocd+libswd-f59ec2043b840a4534fdd61502de59e2571988d5.tar.gz
openocd+libswd-f59ec2043b840a4534fdd61502de59e2571988d5.tar.bz2
openocd+libswd-f59ec2043b840a4534fdd61502de59e2571988d5.tar.xz
openocd+libswd-f59ec2043b840a4534fdd61502de59e2571988d5.zip
log_callback_t -> struct log_callback
Removes useless and confusing typedef for log callback structure. Types with _t should be suitable for passing by-value as arguments.
-rw-r--r--src/helper/log.c10
-rw-r--r--src/helper/log.h7
2 files changed, 8 insertions, 9 deletions
diff --git a/src/helper/log.c b/src/helper/log.c
index ccc0c01b..1724becc 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -45,7 +45,7 @@
int debug_level = -1;
static FILE* log_output;
-static log_callback_t *log_callbacks = NULL;
+static struct log_callback *log_callbacks = NULL;
static long long last_time;
static long long current_time;
@@ -82,7 +82,7 @@ static void log_forward(const char *file, int line, const char *function, const
{
if (log_forward_count==0)
{
- log_callback_t *cb, *next;
+ struct log_callback *cb, *next;
cb = log_callbacks;
/* DANGER!!!! the log callback can remove itself!!!! */
while (cb)
@@ -353,7 +353,7 @@ int set_log_output(struct command_context_s *cmd_ctx, FILE *output)
/* add/remove log callback handler */
int log_add_callback(log_callback_fn fn, void *priv)
{
- log_callback_t *cb;
+ struct log_callback *cb;
/* prevent the same callback to be registered more than once, just for sure */
for (cb = log_callbacks; cb; cb = cb->next)
@@ -363,7 +363,7 @@ int log_add_callback(log_callback_fn fn, void *priv)
}
/* alloc memory, it is safe just to return in case of an error, no need for the caller to check this */
- if ((cb = malloc(sizeof(log_callback_t))) == NULL)
+ if ((cb = malloc(sizeof(struct log_callback))) == NULL)
return ERROR_BUF_TOO_SMALL;
/* add item to the beginning of the linked list */
@@ -377,7 +377,7 @@ int log_add_callback(log_callback_fn fn, void *priv)
int log_remove_callback(log_callback_fn fn, void *priv)
{
- log_callback_t *cb, **p;
+ struct log_callback *cb, **p;
for (p = &log_callbacks; (cb = *p); p = &(*p)->next)
{
diff --git a/src/helper/log.h b/src/helper/log.h
index aabd1be2..5742897d 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -88,12 +88,11 @@ void log_rethrow(void);
typedef void (*log_callback_fn)(void *priv, const char *file, unsigned line,
const char *function, const char *string);
-typedef struct log_callback_s
-{
+struct log_callback {
log_callback_fn fn;
void *priv;
- struct log_callback_s *next;
-} log_callback_t;
+ struct log_callback *next;
+};
int log_add_callback(log_callback_fn fn, void *priv);
int log_remove_callback(log_callback_fn fn, void *priv);