Tweak macros to avoid extraneous semicolons.

-Wextra-semi-stmt complains about this.
This commit is contained in:
Emil Mikulic 2020-07-01 19:43:30 +10:00
parent 9274bfbfe9
commit 36aadb6f90

View File

@ -1238,13 +1238,14 @@ static void log_connection(const struct connection *conn) {
if (conn->method == NULL) if (conn->method == NULL)
return; /* invalid - didn't parse - maybe too long */ return; /* invalid - didn't parse - maybe too long */
#define make_safe(x) \ #define make_safe(x) do { \
if (conn->x) { \ if (conn->x) { \
safe_##x = xmalloc(strlen(conn->x)*3 + 1); \ safe_##x = xmalloc(strlen(conn->x)*3 + 1); \
logencode(conn->x, safe_##x); \ logencode(conn->x, safe_##x); \
} else { \ } else { \
safe_##x = NULL; \ safe_##x = NULL; \
} } \
} while(0)
make_safe(method); make_safe(method);
make_safe(url); make_safe(url);
@ -1265,7 +1266,7 @@ static void log_connection(const struct connection *conn) {
); );
fflush(logfile); fflush(logfile);
#define free_safe(x) if (safe_##x) free(safe_##x); #define free_safe(x) if (safe_##x) free(safe_##x)
free_safe(method); free_safe(method);
free_safe(url); free_safe(url);
@ -2354,8 +2355,9 @@ static void httpd_poll(void) {
max_fd = 0; max_fd = 0;
/* set recv/send fd_sets */ /* set recv/send fd_sets */
#define MAX_FD_SET(sock, fdset) { FD_SET(sock,fdset); \ #define MAX_FD_SET(sock, fdset) do { FD_SET(sock,fdset); \
max_fd = (max_fd<sock) ? sock : max_fd; } max_fd = (max_fd<sock) ? sock : max_fd; } \
while (0)
if (accepting) MAX_FD_SET(sockin, &recv_set); if (accepting) MAX_FD_SET(sockin, &recv_set);
LIST_FOREACH_SAFE(conn, &connlist, entries, next) { LIST_FOREACH_SAFE(conn, &connlist, entries, next) {