summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2017-03-23 21:37:17 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2017-03-28 02:17:33 -0400
commita53f662a30ce340fb2b7f233f573aa9c30b935b9 (patch)
tree143d805da68b06f11005b5451e895d3b60958173
parent14890c1c8956094468b04b1d9762e0884275d55d (diff)
downloadlighttpd1.4-a53f662a30ce340fb2b7f233f573aa9c30b935b9.tar.gz
lighttpd1.4-a53f662a30ce340fb2b7f233f573aa9c30b935b9.zip
[core] remove some unused header includes
remove exposure of stdio.h in buffer.h for print_backtrace(), now static
-rw-r--r--src/buffer.c11
-rw-r--r--src/buffer.h3
-rw-r--r--src/chunk.c1
-rw-r--r--src/configfile.c1
-rw-r--r--src/configparser.y1
-rw-r--r--src/connections.c3
-rw-r--r--src/data_string.c1
-rw-r--r--src/fdevent.c2
-rw-r--r--src/fdevent_freebsd_kqueue.c2
-rw-r--r--src/fdevent_libev.c2
-rw-r--r--src/fdevent_linux_sysepoll.c3
-rw-r--r--src/fdevent_poll.c3
-rw-r--r--src/fdevent_select.c3
-rw-r--r--src/fdevent_solaris_devpoll.c2
-rw-r--r--src/fdevent_solaris_port.c2
-rw-r--r--src/http_chunk.c2
-rw-r--r--src/keyvalue.c1
-rw-r--r--src/md5.h1
-rw-r--r--src/mod_access.c1
-rw-r--r--src/mod_accesslog.c3
-rw-r--r--src/mod_alias.c2
-rw-r--r--src/mod_authn_file.c2
-rw-r--r--src/mod_authn_ldap.c1
-rw-r--r--src/mod_authn_mysql.c2
-rw-r--r--src/mod_cgi.c11
-rw-r--r--src/mod_cml.c1
-rw-r--r--src/mod_cml_funcs.c1
-rw-r--r--src/mod_cml_lua.c2
-rw-r--r--src/mod_compress.c2
-rw-r--r--src/mod_dirlisting.c3
-rw-r--r--src/mod_evasive.c1
-rw-r--r--src/mod_evhost.c1
-rw-r--r--src/mod_expire.c1
-rw-r--r--src/mod_extforward.c6
-rw-r--r--src/mod_fastcgi.c5
-rw-r--r--src/mod_flv_streaming.c1
-rw-r--r--src/mod_indexfile.c1
-rw-r--r--src/mod_magnet.c2
-rw-r--r--src/mod_magnet_cache.c1
-rw-r--r--src/mod_mysql_vhost.c2
-rw-r--r--src/mod_proxy.c6
-rw-r--r--src/mod_rrdtool.c2
-rw-r--r--src/mod_scgi.c7
-rw-r--r--src/mod_secdownload.c1
-rw-r--r--src/mod_simple_vhost.c2
-rw-r--r--src/mod_skeleton.c1
-rw-r--r--src/mod_ssi.c3
-rw-r--r--src/mod_ssi_exprparser.y1
-rw-r--r--src/mod_staticfile.c2
-rw-r--r--src/mod_trigger_b4_dl.c2
-rw-r--r--src/mod_usertrack.c1
-rw-r--r--src/mod_webdav.c3
-rw-r--r--src/network.c1
-rw-r--r--src/plugin.c2
-rw-r--r--src/proc_open.c1
-rw-r--r--src/rand.c1
-rw-r--r--src/request.c2
-rw-r--r--src/response.c5
-rw-r--r--src/server.c1
-rw-r--r--src/stat_cache.c2
-rw-r--r--src/stream.c1
-rw-r--r--src/test_buffer.c3
62 files changed, 15 insertions, 131 deletions
diff --git a/src/buffer.c b/src/buffer.c
index cdbbde3e..a49eef15 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5,10 +5,6 @@
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-#include <ctype.h>
-
static const char hex_chars[] = "0123456789abcdef";
/**
@@ -1006,11 +1002,14 @@ void buffer_to_upper(buffer *b) {
}
}
+
+#include <stdio.h>
+
#ifdef HAVE_LIBUNWIND
# define UNW_LOCAL_ONLY
# include <libunwind.h>
-void print_backtrace(FILE *file) {
+static void print_backtrace(FILE *file) {
unw_cursor_t cursor;
unw_context_t context;
int ret;
@@ -1071,7 +1070,7 @@ error:
fprintf(file, "Error while generating backtrace: unwind error %i\n", (int) -ret);
}
#else
-void print_backtrace(FILE *file) {
+static void print_backtrace(FILE *file) {
UNUSED(file);
}
#endif
diff --git a/src/buffer.h b/src/buffer.h
index a9bfa006..44cf1310 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -4,9 +4,7 @@
#include "settings.h"
-#include <stdlib.h>
#include <sys/types.h>
-#include <stdio.h>
#include <time.h>
#if defined HAVE_STDINT_H
@@ -163,7 +161,6 @@ static inline void buffer_append_slash(buffer *b); /* append '/' no non-empty st
#define CONST_BUF_LEN(x) ((x) ? (x)->ptr : NULL), buffer_string_length(x)
-void print_backtrace(FILE *file);
void log_failed_assert(const char *filename, unsigned int line, const char *msg) LI_NORETURN;
#define force_assert(x) do { if (!(x)) log_failed_assert(__FILE__, __LINE__, "assertion failed: " #x); } while(0)
#define SEGFAULT() log_failed_assert(__FILE__, __LINE__, "aborted");
diff --git a/src/chunk.c b/src/chunk.c
index ae8e3da8..f3f9b84c 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -18,7 +18,6 @@
#include <fcntl.h>
#include <unistd.h>
-#include <stdio.h>
#include <errno.h>
#include <string.h>
diff --git a/src/configfile.c b/src/configfile.c
index 8399081e..93944822 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -20,7 +20,6 @@
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
-#include <assert.h>
#include <glob.h>
diff --git a/src/configparser.y b/src/configparser.y
index 66165d86..b46651ce 100644
--- a/src/configparser.y
+++ b/src/configparser.y
@@ -9,7 +9,6 @@
#include "array.h"
#include "request.h" /* http_request_host_normalize() */
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
diff --git a/src/connections.c b/src/connections.c
index 1d957780..485fbff5 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -21,12 +21,9 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
-#include <fcntl.h>
-#include <assert.h>
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
diff --git a/src/data_string.c b/src/data_string.c
index c1573a96..f9e50d39 100644
--- a/src/data_string.c
+++ b/src/data_string.c
@@ -5,7 +5,6 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
static data_unset *data_string_copy(const data_unset *s) {
data_string *src = (data_string *)s;
diff --git a/src/fdevent.c b/src/fdevent.c
index b547ebb9..b9c3fa24 100644
--- a/src/fdevent.c
+++ b/src/fdevent.c
@@ -9,9 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <stdio.h>
#include <fcntl.h>
-#include <assert.h>
fdevents *fdevent_init(server *srv, size_t maxfds, fdevent_handler_t type) {
diff --git a/src/fdevent_freebsd_kqueue.c b/src/fdevent_freebsd_kqueue.c
index 3c4ec9bd..17eae08a 100644
--- a/src/fdevent_freebsd_kqueue.c
+++ b/src/fdevent_freebsd_kqueue.c
@@ -8,10 +8,8 @@
#include <unistd.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <signal.h>
#include <fcntl.h>
#ifdef USE_FREEBSD_KQUEUE
diff --git a/src/fdevent_libev.c b/src/fdevent_libev.c
index 70b5d566..978fc2da 100644
--- a/src/fdevent_libev.c
+++ b/src/fdevent_libev.c
@@ -4,8 +4,6 @@
#include "buffer.h"
#include "log.h"
-#include <assert.h>
-
#ifdef USE_LIBEV
# include <ev.h>
diff --git a/src/fdevent_linux_sysepoll.c b/src/fdevent_linux_sysepoll.c
index 391833d4..c0e4384e 100644
--- a/src/fdevent_linux_sysepoll.c
+++ b/src/fdevent_linux_sysepoll.c
@@ -8,11 +8,8 @@
#include <unistd.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
#ifdef USE_LINUX_EPOLL
diff --git a/src/fdevent_poll.c b/src/fdevent_poll.c
index df7da599..3401b57d 100644
--- a/src/fdevent_poll.c
+++ b/src/fdevent_poll.c
@@ -8,11 +8,8 @@
#include <unistd.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
#ifdef USE_POLL
diff --git a/src/fdevent_select.c b/src/fdevent_select.c
index 356c3bd1..c7fe3063 100644
--- a/src/fdevent_select.c
+++ b/src/fdevent_select.c
@@ -11,9 +11,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <assert.h>
#ifdef USE_SELECT
diff --git a/src/fdevent_solaris_devpoll.c b/src/fdevent_solaris_devpoll.c
index c3b8f6e9..3ecb8717 100644
--- a/src/fdevent_solaris_devpoll.c
+++ b/src/fdevent_solaris_devpoll.c
@@ -8,10 +8,8 @@
#include <unistd.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <signal.h>
#include <fcntl.h>
#ifdef USE_SOLARIS_DEVPOLL
diff --git a/src/fdevent_solaris_port.c b/src/fdevent_solaris_port.c
index 3100d30d..b196bb9b 100644
--- a/src/fdevent_solaris_port.c
+++ b/src/fdevent_solaris_port.c
@@ -8,10 +8,8 @@
#include <unistd.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <signal.h>
#include <fcntl.h>
#ifdef USE_SOLARIS_PORT
diff --git a/src/http_chunk.c b/src/http_chunk.c
index 34d2038f..89faab69 100644
--- a/src/http_chunk.c
+++ b/src/http_chunk.c
@@ -16,10 +16,8 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <fcntl.h>
#include <unistd.h>
-#include <stdio.h>
#include <errno.h>
#include <string.h>
diff --git a/src/keyvalue.c b/src/keyvalue.c
index 1d3c6bda..d144b15c 100644
--- a/src/keyvalue.c
+++ b/src/keyvalue.c
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
static keyvalue http_versions[] = {
{ HTTP_VERSION_1_1, "HTTP/1.1" },
diff --git a/src/md5.h b/src/md5.h
index 353ba51e..bf6b107f 100644
--- a/src/md5.h
+++ b/src/md5.h
@@ -27,7 +27,6 @@ These notices must be retained in any copies of any part of this
documentation and/or software.
*/
-#include <limits.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
diff --git a/src/mod_access.c b/src/mod_access.c
index 24b4bd8b..3c36e404 100644
--- a/src/mod_access.c
+++ b/src/mod_access.c
@@ -6,7 +6,6 @@
#include "plugin.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c
index 84ef2597..7980446f 100644
--- a/src/mod_accesslog.c
+++ b/src/mod_accesslog.c
@@ -9,7 +9,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
@@ -17,8 +16,6 @@
#include <errno.h>
#include <time.h>
-#include <stdio.h>
-
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
diff --git a/src/mod_alias.c b/src/mod_alias.c
index a19556db..18569943 100644
--- a/src/mod_alias.c
+++ b/src/mod_alias.c
@@ -6,10 +6,8 @@
#include "plugin.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
/* plugin config for all request/connections */
typedef struct {
diff --git a/src/mod_authn_file.c b/src/mod_authn_file.c
index c5cf3c2b..b5054fb4 100644
--- a/src/mod_authn_file.c
+++ b/src/mod_authn_file.c
@@ -34,7 +34,6 @@
#include "log.h"
#include "response.h"
-#include "inet_ntop_cache.h"
#include "base64.h"
#include "md5.h"
@@ -42,6 +41,7 @@
#include <sys/stat.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/src/mod_authn_ldap.c b/src/mod_authn_ldap.c
index ed9d399b..d8be4f5f 100644
--- a/src/mod_authn_ldap.c
+++ b/src/mod_authn_ldap.c
@@ -8,7 +8,6 @@
#include "log.h"
#include "plugin.h"
-#include <ctype.h>
#include <errno.h>
#include <string.h>
diff --git a/src/mod_authn_mysql.c b/src/mod_authn_mysql.c
index e712c3f4..25e66d38 100644
--- a/src/mod_authn_mysql.c
+++ b/src/mod_authn_mysql.c
@@ -26,8 +26,8 @@
#include "md5.h"
#include "plugin.h"
-#include <ctype.h>
#include <errno.h>
+#include <stdio.h>
#include <string.h>
#ifdef HAVE_CRYPT_H
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index 3ffcd34a..5e22f512 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -13,15 +13,8 @@
#include <sys/types.h>
#include "sys-mmap.h"
-
-#ifdef __WIN32
-# include <winsock2.h>
-#else
-# include <sys/socket.h>
+#include "sys-socket.h"
# include <sys/wait.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-#endif
#include <unistd.h>
#include <errno.h>
@@ -29,8 +22,6 @@
#include <string.h>
#include <fdevent.h>
#include <signal.h>
-#include <ctype.h>
-#include <assert.h>
#include <stdio.h>
#include <fcntl.h>
diff --git a/src/mod_cml.c b/src/mod_cml.c
index 6fcc4622..13466d14 100644
--- a/src/mod_cml.c
+++ b/src/mod_cml.c
@@ -15,7 +15,6 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#include <stdio.h>
/* init the plugin data */
INIT_FUNC(mod_cml_init) {
diff --git a/src/mod_cml_funcs.c b/src/mod_cml_funcs.c
index a62ec5e4..7c53c381 100644
--- a/src/mod_cml_funcs.c
+++ b/src/mod_cml_funcs.c
@@ -8,7 +8,6 @@
#include <errno.h>
#include <unistd.h>
#include <dirent.h>
-#include <stdio.h>
#include <lauxlib.h>
diff --git a/src/mod_cml_lua.c b/src/mod_cml_lua.c
index e9f5c8b8..de344fd1 100644
--- a/src/mod_cml_lua.c
+++ b/src/mod_cml_lua.c
@@ -4,8 +4,6 @@
#include <lualib.h>
#include <lauxlib.h>
-#include <assert.h>
-#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <string.h>
diff --git a/src/mod_compress.c b/src/mod_compress.c
index 391108ee..f08805dc 100644
--- a/src/mod_compress.c
+++ b/src/mod_compress.c
@@ -14,10 +14,8 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c
index 8099cee7..dd93aaed 100644
--- a/src/mod_dirlisting.c
+++ b/src/mod_dirlisting.c
@@ -9,14 +9,11 @@
#include "response.h"
#include "stat_cache.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
-#include <stdio.h>
#include <unistd.h>
#include <time.h>
diff --git a/src/mod_evasive.c b/src/mod_evasive.c
index 3aebb986..53aacb1d 100644
--- a/src/mod_evasive.c
+++ b/src/mod_evasive.c
@@ -9,7 +9,6 @@
#include "inet_ntop_cache.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/mod_evhost.c b/src/mod_evhost.c
index eabee5ca..0a8cfbc4 100644
--- a/src/mod_evhost.c
+++ b/src/mod_evhost.c
@@ -7,7 +7,6 @@
#include <string.h>
#include <errno.h>
-#include <ctype.h>
typedef struct {
/* unparsed pieces */
diff --git a/src/mod_expire.c b/src/mod_expire.c
index c06488ca..e40780ab 100644
--- a/src/mod_expire.c
+++ b/src/mod_expire.c
@@ -8,7 +8,6 @@
#include "plugin.h"
#include "stat_cache.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/src/mod_extforward.c b/src/mod_extforward.c
index a96e722d..144e3206 100644
--- a/src/mod_extforward.c
+++ b/src/mod_extforward.c
@@ -6,15 +6,11 @@
#include "plugin.h"
-#include "inet_ntop_cache.h"
#include "configfile.h"
-#include <assert.h>
-#include <ctype.h>
+#include "sys-socket.h"
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
-#include <netinet/in.h>
#include <errno.h>
/**
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index 9334aa26..c3a024b3 100644
--- a/src/mod_fastcgi.c
+++ b/src/mod_fastcgi.c
@@ -13,7 +13,6 @@
#include "plugin.h"
-#include "inet_ntop_cache.h"
#include "stat_cache.h"
#include "status_counter.h"
@@ -23,8 +22,6 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
#include <signal.h>
#ifdef HAVE_FASTCGI_FASTCGI_H
@@ -37,8 +34,6 @@
# endif
#endif /* HAVE_FASTCGI_FASTCGI_H */
-#include <stdio.h>
-
#include "sys-socket.h"
#ifdef HAVE_SYS_UIO_H
diff --git a/src/mod_flv_streaming.c b/src/mod_flv_streaming.c
index 8724ab6b..9c9ae997 100644
--- a/src/mod_flv_streaming.c
+++ b/src/mod_flv_streaming.c
@@ -9,7 +9,6 @@
#include "plugin.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/mod_indexfile.c b/src/mod_indexfile.c
index f2a45888..7979ad5b 100644
--- a/src/mod_indexfile.c
+++ b/src/mod_indexfile.c
@@ -8,7 +8,6 @@
#include "stat_cache.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
diff --git a/src/mod_magnet.c b/src/mod_magnet.c
index 0329166c..b460f3c7 100644
--- a/src/mod_magnet.c
+++ b/src/mod_magnet.c
@@ -13,10 +13,8 @@
#include "status_counter.h"
#include "etag.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <setjmp.h>
#include <lua.h>
diff --git a/src/mod_magnet_cache.c b/src/mod_magnet_cache.c
index 11c41a9d..1f8de572 100644
--- a/src/mod_magnet_cache.c
+++ b/src/mod_magnet_cache.c
@@ -5,7 +5,6 @@
#include <stdlib.h>
#include <time.h>
-#include <assert.h>
#include <lualib.h>
#include <lauxlib.h>
diff --git a/src/mod_mysql_vhost.c b/src/mod_mysql_vhost.c
index 06bde417..4c37bee6 100644
--- a/src/mod_mysql_vhost.c
+++ b/src/mod_mysql_vhost.c
@@ -1,9 +1,7 @@
#include "first.h"
#include <unistd.h>
-#include <stdio.h>
#include <errno.h>
-#include <fcntl.h>
#include <string.h>
#include <mysql.h>
diff --git a/src/mod_proxy.c b/src/mod_proxy.c
index 1515f4dd..11ef57e4 100644
--- a/src/mod_proxy.c
+++ b/src/mod_proxy.c
@@ -20,13 +20,9 @@
#include <unistd.h>
#include <errno.h>
-#include <fcntl.h>
+#include <limits.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include <stdio.h>
#include "sys-socket.h"
diff --git a/src/mod_rrdtool.c b/src/mod_rrdtool.c
index 380c4987..d9c26b70 100644
--- a/src/mod_rrdtool.c
+++ b/src/mod_rrdtool.c
@@ -9,10 +9,8 @@
#include "plugin.h"
#include <sys/types.h>
-#include <assert.h>
#include <fcntl.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
diff --git a/src/mod_scgi.c b/src/mod_scgi.c
index 4c50fd4c..7d277611 100644
--- a/src/mod_scgi.c
+++ b/src/mod_scgi.c
@@ -13,20 +13,15 @@
#include "plugin.h"
-#include "inet_ntop_cache.h"
-
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
#include <signal.h>
-#include <stdio.h>
-
#include "sys-socket.h"
#include "sys-endian.h"
diff --git a/src/mod_secdownload.c b/src/mod_secdownload.c
index 4a00c933..ce233cba 100644
--- a/src/mod_secdownload.c
+++ b/src/mod_secdownload.c
@@ -7,7 +7,6 @@
#include "plugin.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/mod_simple_vhost.c b/src/mod_simple_vhost.c
index 16fca1ce..985e0fe2 100644
--- a/src/mod_simple_vhost.c
+++ b/src/mod_simple_vhost.c
@@ -7,8 +7,6 @@
#include "plugin.h"
-#include <assert.h>
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
diff --git a/src/mod_skeleton.c b/src/mod_skeleton.c
index 32996a18..60f211cc 100644
--- a/src/mod_skeleton.c
+++ b/src/mod_skeleton.c
@@ -6,7 +6,6 @@
#include "plugin.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/mod_ssi.c b/src/mod_ssi.c
index a260ad47..bb76b379 100644
--- a/src/mod_ssi.c
+++ b/src/mod_ssi.c
@@ -10,15 +10,12 @@
#include "mod_ssi.h"
-#include "inet_ntop_cache.h"
-
#include "sys-socket.h"
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
diff --git a/src/mod_ssi_exprparser.y b/src/mod_ssi_exprparser.y
index ee40912b..0b18edc1 100644
--- a/src/mod_ssi_exprparser.y
+++ b/src/mod_ssi_exprparser.y
@@ -8,7 +8,6 @@
#include "mod_ssi_expr.h"
#include "buffer.h"
-#include <assert.h>
#include <string.h>
}
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index e4fb52a1..da906c39 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -11,9 +11,7 @@
#include "http_chunk.h"
#include "response.h"
-#include <ctype.h>
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
/**
diff --git a/src/mod_trigger_b4_dl.c b/src/mod_trigger_b4_dl.c
index 4301468b..8ccb0906 100644
--- a/src/mod_trigger_b4_dl.c
+++ b/src/mod_trigger_b4_dl.c
@@ -8,9 +8,7 @@
#include "response.h"
#include "inet_ntop_cache.h"
-#include <ctype.h>
#include <stdlib.h>
-#include <fcntl.h>
#include <string.h>
#if defined(HAVE_GDBM_H)
diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c
index fb086f65..3cd76289 100644
--- a/src/mod_usertrack.c
+++ b/src/mod_usertrack.c
@@ -7,7 +7,6 @@
#include "plugin.h"
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index 26f5d93e..e298d826 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -14,13 +14,10 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
-#include <stdio.h>
-#include <assert.h>
#include <unistd.h>
#include <dirent.h>
diff --git a/src/network.c b/src/network.c
index 47c00561..31292125 100644
--- a/src/network.c
+++ b/src/network.c
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
void
network_accept_tcp_nagle_disable (const int fd)
diff --git a/src/plugin.c b/src/plugin.c
index 07494d16..0a035d2f 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -6,8 +6,6 @@
#include <string.h>
#include <stdlib.h>
-#include <stdio.h>
-
#ifdef HAVE_VALGRIND_VALGRIND_H
# include <valgrind/valgrind.h>
#endif
diff --git a/src/proc_open.c b/src/proc_open.c
index 2023443d..ea6eb893 100644
--- a/src/proc_open.c
+++ b/src/proc_open.c
@@ -4,7 +4,6 @@
#include <stdlib.h>
#include <stdio.h>
-#include <ctype.h>
#include <string.h>
#include <errno.h>
diff --git a/src/rand.c b/src/rand.c
index 328a344d..fc79ea86 100644
--- a/src/rand.c
+++ b/src/rand.c
@@ -9,7 +9,6 @@
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/src/request.c b/src/request.c
index 8af0f843..dccea7ac 100644
--- a/src/request.c
+++ b/src/request.c
@@ -9,8 +9,6 @@
#include <limits.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
static int request_check_hostname(buffer *host) {
enum { DOMAINLABEL, TOPLABEL } stage = TOPLABEL;
diff --git a/src/response.c b/src/response.c
index 74a9cbc7..e77926d7 100644
--- a/src/response.c
+++ b/src/response.c
@@ -15,15 +15,10 @@
#include <limits.h>
#include <errno.h>
-#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include <stdio.h>
#include "sys-socket.h"
diff --git a/src/server.c b/src/server.c
index c7f114e6..71f67ab9 100644
--- a/src/server.c
+++ b/src/server.c
@@ -39,7 +39,6 @@
#include <stdlib.h>
#include <time.h>
#include <signal.h>
-#include <assert.h>
#include <locale.h>
#include <stdio.h>
diff --git a/src/stat_cache.c b/src/stat_cache.c
index 8fbcca55..8e4468d1 100644
--- a/src/stat_cache.c
+++ b/src/stat_cache.c
@@ -12,9 +12,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#include <stdio.h>
#include <fcntl.h>
-#include <assert.h>
#ifdef HAVE_ATTR_ATTRIBUTES_H
# include <attr/attributes.h>
diff --git a/src/stream.c b/src/stream.c
index 81ccd9a3..9099bf67 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -7,6 +7,7 @@
#include <unistd.h>
#include <fcntl.h>
+#include <stdlib.h>
#include "sys-mmap.h"
diff --git a/src/test_buffer.c b/src/test_buffer.c
index d565bd07..84667578 100644
--- a/src/test_buffer.c
+++ b/src/test_buffer.c
@@ -1,5 +1,8 @@
#include "first.h"
+#include <stdio.h>
+#include <stdlib.h>
+
#include "buffer.h"
static void run_buffer_path_simplify(buffer *psrc, buffer *pdest, const char *in, size_t in_len, const char *out, size_t out_len) {