Mercurial > hg > nnchat
diff main.c @ 564:6e5789cbb4d4
Change network layer error/info message passing API to pass direct strings
instead of fmt+ap varargs in the connection context callback functions. Also
rename the callback functions in the main program.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 15 Nov 2012 20:27:44 +0200 |
parents | c3e4e8f3c658 |
children | de1af9652fef |
line wrap: on
line diff
--- a/main.c Thu Nov 15 20:26:10 2012 +0200 +++ b/main.c Thu Nov 15 20:27:44 2012 +0200 @@ -383,17 +383,17 @@ } -void errorFunc(struct _nn_conn_t *conn, const char *fmt, va_list ap) +void nn_network_errfunc(struct _nn_conn_t *conn, const char *msg) { (void) conn; - errorMsgV(fmt, ap); + errorMsg("%s", msg); } -void messageFunc(struct _nn_conn_t *conn, const char *fmt, va_list ap) +void nn_network_msgfunc(struct _nn_conn_t *conn, const char *msg) { (void) conn; - printMsgV(NULL, LOG_STAMP | LOG_WINDOW | LOG_FILE, fmt, ap); + printMsgConst(NULL, LOG_STAMP | LOG_WINDOW | LOG_FILE, msg); } @@ -1982,7 +1982,7 @@ } // Create a connection - conn = nn_conn_new(errorFunc, messageFunc); + conn = nn_conn_new(nn_network_errfunc, nn_network_msgfunc); if (conn == NULL) { errorMsg("Could not create connection structure.\n");