diff --git a/mongoose.c b/mongoose.c index e2595a91..fc746ae6 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3706,14 +3706,6 @@ void mg_timer_poll(unsigned long now_ms) { #include #include -#ifndef EXTERN_C -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C -#endif -#endif - #if defined(MBEDTLS_VERSION_NUMBER) && MBEDTLS_VERSION_NUMBER >= 0x03000000 #define RNG , rng_get, NULL #else @@ -3779,9 +3771,9 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) { const char *ca = opts->ca == NULL ? "-" : opts->ca[0] == '-' ? "(emb)" : opts->ca; - const char *crl = opts->crl == NULL ? "-" - : opts->crl[0] == '-' ? "(emb)" - : opts->crl; + const char *crl = opts->crl == NULL ? "-" + : opts->crl[0] == '-' ? "(emb)" + : opts->crl; const char *cert = opts->cert == NULL ? "-" : opts->cert[0] == '-' ? "(emb)" : opts->cert; diff --git a/mongoose.h b/mongoose.h index b47df848..6044fce1 100644 --- a/mongoose.h +++ b/mongoose.h @@ -609,6 +609,14 @@ void mg_usleep(unsigned long usecs); #define mg_htons(x) mg_ntohs(x) #define mg_htonl(x) mg_ntohl(x) +#ifndef EXTERN_C +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C +#endif +#endif + // Expands to a string representation of its argument: e.g. // MG_STRINGIFY_LITERAL(5) expands to "5" #if !defined(_MSC_VER) || _MSC_VER >= 1900 diff --git a/src/tls.c b/src/tls.c index cade329e..459077e0 100644 --- a/src/tls.c +++ b/src/tls.c @@ -8,14 +8,6 @@ #include #include -#ifndef EXTERN_C -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C -#endif -#endif - #if defined(MBEDTLS_VERSION_NUMBER) && MBEDTLS_VERSION_NUMBER >= 0x03000000 #define RNG , rng_get, NULL #else @@ -81,9 +73,9 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) { const char *ca = opts->ca == NULL ? "-" : opts->ca[0] == '-' ? "(emb)" : opts->ca; - const char *crl = opts->crl == NULL ? "-" - : opts->crl[0] == '-' ? "(emb)" - : opts->crl; + const char *crl = opts->crl == NULL ? "-" + : opts->crl[0] == '-' ? "(emb)" + : opts->crl; const char *cert = opts->cert == NULL ? "-" : opts->cert[0] == '-' ? "(emb)" : opts->cert; diff --git a/src/util.h b/src/util.h index c89bbf68..bcd5dbd4 100644 --- a/src/util.h +++ b/src/util.h @@ -27,6 +27,14 @@ void mg_usleep(unsigned long usecs); #define mg_htons(x) mg_ntohs(x) #define mg_htonl(x) mg_ntohl(x) +#ifndef EXTERN_C +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C +#endif +#endif + // Expands to a string representation of its argument: e.g. // MG_STRINGIFY_LITERAL(5) expands to "5" #if !defined(_MSC_VER) || _MSC_VER >= 1900