Bring preprocessor directives in line.

This commit is contained in:
Emil Mikulic 2011-05-01 19:29:13 +10:00
parent a3b31af2be
commit 07be6a2f1b

View File

@ -1912,12 +1912,11 @@ static void process_request(struct connection *conn) {
/* Receiving request. */ /* Receiving request. */
static void poll_recv_request(struct connection *conn) { static void poll_recv_request(struct connection *conn) {
#define BUFSIZE 65536 char buf[1<<15];
char buf[BUFSIZE];
ssize_t recvd; ssize_t recvd;
assert(conn->state == RECV_REQUEST); assert(conn->state == RECV_REQUEST);
recvd = recv(conn->socket, buf, BUFSIZE, 0); recvd = recv(conn->socket, buf, sizeof(buf), 0);
if (debug) if (debug)
printf("poll_recv_request(%d) got %d bytes\n", printf("poll_recv_request(%d) got %d bytes\n",
conn->socket, (int)recvd); conn->socket, (int)recvd);
@ -1935,7 +1934,6 @@ static void poll_recv_request(struct connection *conn) {
return; return;
} }
conn->last_active = now; conn->last_active = now;
#undef BUFSIZE
/* append to conn->request */ /* append to conn->request */
assert(recvd > 0); assert(recvd > 0);
@ -2046,11 +2044,10 @@ static ssize_t send_from_file(const int s, const int fd,
size = 1<<20; size = 1<<20;
return sendfile(s, fd, &ofs, size); return sendfile(s, fd, &ofs, size);
#else #else
#define BUFSIZE 20000
char buf[BUFSIZE]; char buf[1<<15];
size_t amount = min((size_t)BUFSIZE, size); size_t amount = min(sizeof(buf), size);
ssize_t numread; ssize_t numread;
#undef BUFSIZE
if (lseek(fd, ofs, SEEK_SET) == -1) if (lseek(fd, ofs, SEEK_SET) == -1)
err(1, "fseek(%d)", (int)ofs); err(1, "fseek(%d)", (int)ofs);
@ -2152,7 +2149,6 @@ static void httpd_poll(void) {
/* 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) { FD_SET(sock,fdset); \
max_fd = (max_fd<sock) ? sock : max_fd; } max_fd = (max_fd<sock) ? sock : max_fd; }
MAX_FD_SET(sockin, &recv_set); MAX_FD_SET(sockin, &recv_set);
LIST_FOREACH_SAFE(conn, &connlist, entries, next) { LIST_FOREACH_SAFE(conn, &connlist, entries, next) {