From 4eadf3699f59eda6e4e6ee394f1773abb39fcd21 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 11 Mar 2025 16:00:42 -0300 Subject: [PATCH] unbreak C89 --- mongoose.c | 9 +++++++++ mongoose.h | 9 ++------- src/util.c | 9 +++++++++ src/util.h | 9 ++------- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/mongoose.c b/mongoose.c index 0403468d..ae79bce8 100644 --- a/mongoose.c +++ b/mongoose.c @@ -19287,6 +19287,15 @@ uint64_t mg_millis(void) { } #endif +// network format equates big endian order +uint16_t mg_ntohs(uint16_t net) { + return MG_LOAD_BE16(&net); +} + +uint32_t mg_ntohl(uint32_t net) { + return MG_LOAD_BE32(&net); +} + #ifdef MG_ENABLE_LINES #line 1 "src/wifi_dummy.c" #endif diff --git a/mongoose.h b/mongoose.h index 8469c739..9bce23c2 100644 --- a/mongoose.h +++ b/mongoose.h @@ -1147,13 +1147,8 @@ bool mg_path_is_sane(const struct mg_str path); MG_U8P(p)[3] = (n) &255; \ } while (0) -// network format equates big endian order -static inline uint16_t mg_ntohs(uint16_t net) { - return MG_LOAD_BE16(&net); -} -static inline uint32_t mg_ntohl(uint32_t net) { - return MG_LOAD_BE32(&net); -} +uint16_t mg_ntohs(uint16_t net); +uint32_t mg_ntohl(uint32_t net); #define mg_htons(x) mg_ntohs(x) #define mg_htonl(x) mg_ntohl(x) diff --git a/src/util.c b/src/util.c index cbb92872..9947f14a 100644 --- a/src/util.c +++ b/src/util.c @@ -184,3 +184,12 @@ uint64_t mg_millis(void) { #endif } #endif + +// network format equates big endian order +uint16_t mg_ntohs(uint16_t net) { + return MG_LOAD_BE16(&net); +} + +uint32_t mg_ntohl(uint32_t net) { + return MG_LOAD_BE32(&net); +} diff --git a/src/util.h b/src/util.h index 0b5b82cf..9c1399d0 100644 --- a/src/util.h +++ b/src/util.h @@ -57,13 +57,8 @@ bool mg_path_is_sane(const struct mg_str path); MG_U8P(p)[3] = (n) &255; \ } while (0) -// network format equates big endian order -static inline uint16_t mg_ntohs(uint16_t net) { - return MG_LOAD_BE16(&net); -} -static inline uint32_t mg_ntohl(uint32_t net) { - return MG_LOAD_BE32(&net); -} +uint16_t mg_ntohs(uint16_t net); +uint32_t mg_ntohl(uint32_t net); #define mg_htons(x) mg_ntohs(x) #define mg_htonl(x) mg_ntohl(x)