Commit 0cf51705 authored by Benjamin REIS's avatar Benjamin REIS

wrap BctoolboxLogFunc to BctoolboxLogHandlerFunc

parent 44ab6e48
......@@ -48,7 +48,8 @@ typedef enum {
BCTBX_LOG_LOGLEV_END=1<<6
} BctbxLogLevel;
typedef void (*BctoolboxLogFunc)(void *info,const char *domain, BctbxLogLevel lev, const char *fmt, va_list args);
typedef void (*BctoolboxLogFunc)(const char *domain, BctbxLogLevel lev, const char *fmt, va_list args);
typedef void (*BctoolboxLogHandlerFunc)(void *info,const char *domain, BctbxLogLevel lev, const char *fmt, va_list args);
typedef struct _BctoolboxLogHandler{
BctoolboxLogFunc func;
......
......@@ -75,10 +75,15 @@ void bctbx_add_log_handler(BctoolboxLogHandler* handler){
}
}
void wrapper(void* info,const char *domain, BctbxLogLevel lev, const char *fmt, va_list args) {
BctoolboxLogFunc func = (BctoolboxLogFunc)info
func(domain, lev, fmt, args);
}
void bctbx_set_log_handler(BctoolboxLogFunc func){
BctoolboxLogHandler* handler = (BctoolboxLogHandler*)malloc(sizeof(BctoolboxLogHandler));;
handler->func=func;
handler->user_info=NULL;
handler->func=wrapper;
handler->user_info=(void*)func;
bctbx_add_log_handler(handler);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment