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;
{
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)
/* 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)
}
/* 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 */
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)
{
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);