Commit 31632c63 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Fix build with CS_ENABLE_STDIO=0

Closes https://github.com/cesanta/mongoose/pull/945

CL: Fix build with CS_ENABLE_STDIO=0

PUBLISHED_FROM=7d15f17fc42241facdba5b1004b5b7f3dda599dc
parent 98c99279
...@@ -549,6 +549,8 @@ void cs_log_set_file(FILE *file); ...@@ -549,6 +549,8 @@ void cs_log_set_file(FILE *file);
*/ */
void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2); void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
#if CS_ENABLE_STDIO
/* /*
* Format and print message `x` with the given level `l`. Example: * Format and print message `x` with the given level `l`. Example:
* *
...@@ -562,6 +564,12 @@ void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2); ...@@ -562,6 +564,12 @@ void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
if (cs_log_print_prefix(l, __func__, __FILE__)) cs_log_printf x; \ if (cs_log_print_prefix(l, __func__, __FILE__)) cs_log_printf x; \
} while (0) } while (0)
#else
#define LOG(l, x) ((void) l)
#endif
#ifndef CS_NDEBUG #ifndef CS_NDEBUG
/* /*
...@@ -623,13 +631,12 @@ enum cs_log_level cs_log_threshold WEAK = ...@@ -623,13 +631,12 @@ enum cs_log_level cs_log_threshold WEAK =
LL_ERROR; LL_ERROR;
#endif #endif
#if CS_ENABLE_STDIO
static char *s_filter_pattern = NULL; static char *s_filter_pattern = NULL;
static size_t s_filter_pattern_len; static size_t s_filter_pattern_len;
void cs_log_set_filter(const char *pattern) WEAK; void cs_log_set_filter(const char *pattern) WEAK;
#if CS_ENABLE_STDIO
FILE *cs_log_file WEAK = NULL; FILE *cs_log_file WEAK = NULL;
#if CS_LOG_ENABLE_TS_DIFF #if CS_LOG_ENABLE_TS_DIFF
...@@ -3729,7 +3736,9 @@ static int mg_accept_conn(struct mg_connection *lc) { ...@@ -3729,7 +3736,9 @@ static int mg_accept_conn(struct mg_connection *lc) {
/* NOTE(lsm): on Windows, sock is always > FD_SETSIZE */ /* NOTE(lsm): on Windows, sock is always > FD_SETSIZE */
sock_t sock = accept(lc->sock, &sa.sa, &sa_len); sock_t sock = accept(lc->sock, &sa.sa, &sa_len);
if (sock == INVALID_SOCKET) { if (sock == INVALID_SOCKET) {
if (mg_is_error()) DBG(("%p: failed to accept: %d", lc, mg_get_errno())); if (mg_is_error()) {
DBG(("%p: failed to accept: %d", lc, mg_get_errno()));
}
return 0; return 0;
} }
nc = mg_if_accept_new_conn(lc); nc = mg_if_accept_new_conn(lc);
...@@ -4837,6 +4846,7 @@ static void mg_ssl_mbed_log(void *ctx, int level, const char *file, int line, ...@@ -4837,6 +4846,7 @@ static void mg_ssl_mbed_log(void *ctx, int level, const char *file, int line,
LOG(cs_level, ("%p %.*s", ctx, (int) (strlen(str) - 1), str)); LOG(cs_level, ("%p %.*s", ctx, (int) (strlen(str) - 1), str));
(void) file; (void) file;
(void) line; (void) line;
(void) cs_level;
} }
struct mg_ssl_if_ctx { struct mg_ssl_if_ctx {
...@@ -15299,6 +15309,8 @@ static void mg_lwip_tcp_write_tcpip(void *arg) { ...@@ -15299,6 +15309,8 @@ static void mg_lwip_tcp_write_tcpip(void *arg) {
return; return;
} }
ctx->ret = len; ctx->ret = len;
(void) unsent;
(void) unacked;
} }
int mg_lwip_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len) { int mg_lwip_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len) {
......
...@@ -31,13 +31,12 @@ enum cs_log_level cs_log_threshold WEAK = ...@@ -31,13 +31,12 @@ enum cs_log_level cs_log_threshold WEAK =
LL_ERROR; LL_ERROR;
#endif #endif
#if CS_ENABLE_STDIO
static char *s_filter_pattern = NULL; static char *s_filter_pattern = NULL;
static size_t s_filter_pattern_len; static size_t s_filter_pattern_len;
void cs_log_set_filter(const char *pattern) WEAK; void cs_log_set_filter(const char *pattern) WEAK;
#if CS_ENABLE_STDIO
FILE *cs_log_file WEAK = NULL; FILE *cs_log_file WEAK = NULL;
#if CS_LOG_ENABLE_TS_DIFF #if CS_LOG_ENABLE_TS_DIFF
......
...@@ -117,6 +117,8 @@ void cs_log_set_file(FILE *file); ...@@ -117,6 +117,8 @@ void cs_log_set_file(FILE *file);
*/ */
void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2); void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
#if CS_ENABLE_STDIO
/* /*
* Format and print message `x` with the given level `l`. Example: * Format and print message `x` with the given level `l`. Example:
* *
...@@ -130,6 +132,12 @@ void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2); ...@@ -130,6 +132,12 @@ void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
if (cs_log_print_prefix(l, __func__, __FILE__)) cs_log_printf x; \ if (cs_log_print_prefix(l, __func__, __FILE__)) cs_log_printf x; \
} while (0) } while (0)
#else
#define LOG(l, x) ((void) l)
#endif
#ifndef CS_NDEBUG #ifndef CS_NDEBUG
/* /*
......
...@@ -501,6 +501,8 @@ static void mg_lwip_tcp_write_tcpip(void *arg) { ...@@ -501,6 +501,8 @@ static void mg_lwip_tcp_write_tcpip(void *arg) {
return; return;
} }
ctx->ret = len; ctx->ret = len;
(void) unsent;
(void) unacked;
} }
int mg_lwip_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len) { int mg_lwip_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len) {
......
...@@ -146,7 +146,9 @@ static int mg_accept_conn(struct mg_connection *lc) { ...@@ -146,7 +146,9 @@ static int mg_accept_conn(struct mg_connection *lc) {
/* NOTE(lsm): on Windows, sock is always > FD_SETSIZE */ /* NOTE(lsm): on Windows, sock is always > FD_SETSIZE */
sock_t sock = accept(lc->sock, &sa.sa, &sa_len); sock_t sock = accept(lc->sock, &sa.sa, &sa_len);
if (sock == INVALID_SOCKET) { if (sock == INVALID_SOCKET) {
if (mg_is_error()) DBG(("%p: failed to accept: %d", lc, mg_get_errno())); if (mg_is_error()) {
DBG(("%p: failed to accept: %d", lc, mg_get_errno()));
}
return 0; return 0;
} }
nc = mg_if_accept_new_conn(lc); nc = mg_if_accept_new_conn(lc);
......
...@@ -34,6 +34,7 @@ static void mg_ssl_mbed_log(void *ctx, int level, const char *file, int line, ...@@ -34,6 +34,7 @@ static void mg_ssl_mbed_log(void *ctx, int level, const char *file, int line,
LOG(cs_level, ("%p %.*s", ctx, (int) (strlen(str) - 1), str)); LOG(cs_level, ("%p %.*s", ctx, (int) (strlen(str) - 1), str));
(void) file; (void) file;
(void) line; (void) line;
(void) cs_level;
} }
struct mg_ssl_if_ctx { struct mg_ssl_if_ctx {
......
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