mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 05:26:15 +08:00
Remove unused MG_SWAPxx macros
This commit is contained in:
parent
16a7ba6bf0
commit
d2744063a0
@ -2938,8 +2938,8 @@ static int write_conn(struct mg_connection *c) {
|
||||
|
||||
static void close_conn(struct mg_connection *c) {
|
||||
// Unlink this connection from the list
|
||||
LIST_DELETE(struct mg_connection, &c->mgr->conns, c);
|
||||
mg_resolve_cancel(c);
|
||||
LIST_DELETE(struct mg_connection, &c->mgr->conns, c);
|
||||
if (c == c->mgr->dns4.c) c->mgr->dns4.c = NULL;
|
||||
if (c == c->mgr->dns6.c) c->mgr->dns6.c = NULL;
|
||||
mg_call(c, MG_EV_CLOSE, NULL);
|
||||
|
16
mongoose.h
16
mongoose.h
@ -511,10 +511,9 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
#define mg_htons(x) mg_ntohs(x)
|
||||
#define mg_htonl(x) mg_ntohl(x)
|
||||
|
||||
#define MG_SWAP16(x) ((((x) >> 8) & 255) | ((x & 255) << 8))
|
||||
#define MG_SWAP32(x) \
|
||||
(((x) >> 24) | (((x) &0xff0000) >> 8) | (((x) &0xff00) << 8) | ((x) << 24))
|
||||
|
||||
// WEAK symbol makes it possible to define a "default" function implementation,
|
||||
// which could be overridden by the user who can define a function with the
|
||||
// same name without linking conflict
|
||||
#if !defined(WEAK)
|
||||
#if (defined(__GNUC__) || defined(__clang__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
@ -532,7 +531,12 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
#else
|
||||
#define MG_STRINGIFY_LITERAL(x) #x
|
||||
#endif
|
||||
// Expands to a string representation of its argument, which can be a macro:
|
||||
// #define FOO 123
|
||||
// MG_STRINGIFY_MACRO(FOO) // Expands to 123
|
||||
#define MG_STRINGIFY_MACRO(x) MG_STRINGIFY_LITERAL(x)
|
||||
|
||||
// Linked list management macros
|
||||
#define LIST_ADD_HEAD(type_, head_, elem_) \
|
||||
do { \
|
||||
(elem_)->next = (*head_); \
|
||||
@ -553,10 +557,6 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
*h = (elem_)->next; \
|
||||
} while (0)
|
||||
|
||||
// Expands to a string representation of its argument, which can be a macro:
|
||||
// #define FOO 123
|
||||
// MG_STRINGIFY_MACRO(FOO) // Expands to 123
|
||||
#define MG_STRINGIFY_MACRO(x) MG_STRINGIFY_LITERAL(x)
|
||||
|
||||
|
||||
|
||||
|
@ -282,8 +282,8 @@ static int write_conn(struct mg_connection *c) {
|
||||
|
||||
static void close_conn(struct mg_connection *c) {
|
||||
// Unlink this connection from the list
|
||||
LIST_DELETE(struct mg_connection, &c->mgr->conns, c);
|
||||
mg_resolve_cancel(c);
|
||||
LIST_DELETE(struct mg_connection, &c->mgr->conns, c);
|
||||
if (c == c->mgr->dns4.c) c->mgr->dns4.c = NULL;
|
||||
if (c == c->mgr->dns6.c) c->mgr->dns6.c = NULL;
|
||||
mg_call(c, MG_EV_CLOSE, NULL);
|
||||
|
16
src/util.h
16
src/util.h
@ -37,10 +37,9 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
#define mg_htons(x) mg_ntohs(x)
|
||||
#define mg_htonl(x) mg_ntohl(x)
|
||||
|
||||
#define MG_SWAP16(x) ((((x) >> 8) & 255) | ((x & 255) << 8))
|
||||
#define MG_SWAP32(x) \
|
||||
(((x) >> 24) | (((x) &0xff0000) >> 8) | (((x) &0xff00) << 8) | ((x) << 24))
|
||||
|
||||
// WEAK symbol makes it possible to define a "default" function implementation,
|
||||
// which could be overridden by the user who can define a function with the
|
||||
// same name without linking conflict
|
||||
#if !defined(WEAK)
|
||||
#if (defined(__GNUC__) || defined(__clang__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
@ -58,7 +57,12 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
#else
|
||||
#define MG_STRINGIFY_LITERAL(x) #x
|
||||
#endif
|
||||
// Expands to a string representation of its argument, which can be a macro:
|
||||
// #define FOO 123
|
||||
// MG_STRINGIFY_MACRO(FOO) // Expands to 123
|
||||
#define MG_STRINGIFY_MACRO(x) MG_STRINGIFY_LITERAL(x)
|
||||
|
||||
// Linked list management macros
|
||||
#define LIST_ADD_HEAD(type_, head_, elem_) \
|
||||
do { \
|
||||
(elem_)->next = (*head_); \
|
||||
@ -79,7 +83,3 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
*h = (elem_)->next; \
|
||||
} while (0)
|
||||
|
||||
// Expands to a string representation of its argument, which can be a macro:
|
||||
// #define FOO 123
|
||||
// MG_STRINGIFY_MACRO(FOO) // Expands to 123
|
||||
#define MG_STRINGIFY_MACRO(x) MG_STRINGIFY_LITERAL(x)
|
||||
|
Loading…
Reference in New Issue
Block a user