summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-10-11 14:31:42 +0000
committerStefan Bühler <stbuehler@web.de>2009-10-11 14:31:42 +0000
commit22e8b456a9800efb92bd0f90a2e1b816d3b4bb07 (patch)
treee306fb18c0c0d4bd3177c4db7a736a8d1d605f40
parentd69683ddb51df40bd175d525f8c53dd4abc2e6e0 (diff)
downloadlighttpd-git-22e8b456a9800efb92bd0f90a2e1b816d3b4bb07.tar.gz
Fix header inclusion order, always include "config.h" before any system header
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2624 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--src/array.c6
-rw-r--r--src/array.h7
-rw-r--r--src/base.h12
-rw-r--r--src/bitset.c6
-rw-r--r--src/buffer.c4
-rw-r--r--src/buffer.h6
-rw-r--r--src/chunk.c4
-rw-r--r--src/configfile-glue.c6
-rw-r--r--src/configfile.c21
-rw-r--r--src/configparser.y10
-rw-r--r--src/connections.c20
-rw-r--r--src/crc32.h6
-rw-r--r--src/data_array.c4
-rw-r--r--src/data_config.c4
-rw-r--r--src/data_count.c4
-rw-r--r--src/data_fastcgi.c6
-rw-r--r--src/data_integer.c4
-rw-r--r--src/data_string.c4
-rw-r--r--src/etag.c14
-rw-r--r--src/etag.h4
-rw-r--r--src/fdevent.c7
-rw-r--r--src/fdevent.h3
-rw-r--r--src/fdevent_freebsd_kqueue.c9
-rw-r--r--src/fdevent_linux_rtsig.c8
-rw-r--r--src/fdevent_linux_sysepoll.c7
-rw-r--r--src/fdevent_poll.c7
-rw-r--r--src/fdevent_select.c7
-rw-r--r--src/fdevent_solaris_devpoll.c7
-rw-r--r--src/http-header-glue.c10
-rw-r--r--src/http_auth.c16
-rw-r--r--src/http_auth_digest.c5
-rw-r--r--src/http_auth_digest.h2
-rw-r--r--src/http_chunk.c10
-rw-r--r--src/inet_ntop_cache.c9
-rw-r--r--src/joblist.c6
-rw-r--r--src/keyvalue.c6
-rw-r--r--src/keyvalue.h2
-rw-r--r--src/log.c15
-rw-r--r--src/md5.c2
-rw-r--r--src/mod_access.c8
-rw-r--r--src/mod_accesslog.c20
-rw-r--r--src/mod_alias.c10
-rw-r--r--src/mod_auth.c10
-rw-r--r--src/mod_cgi.c35
-rw-r--r--src/mod_cml.c18
-rw-r--r--src/mod_cml_funcs.c18
-rw-r--r--src/mod_cml_funcs.h2
-rw-r--r--src/mod_cml_lua.c12
-rw-r--r--src/mod_compress.c24
-rw-r--r--src/mod_dirlisting.c20
-rw-r--r--src/mod_evasive.c8
-rw-r--r--src/mod_evhost.c8
-rw-r--r--src/mod_expire.c10
-rw-r--r--src/mod_extforward.c18
-rw-r--r--src/mod_fastcgi.c33
-rw-r--r--src/mod_flv_streaming.c10
-rw-r--r--src/mod_indexfile.c11
-rw-r--r--src/mod_magnet.c12
-rw-r--r--src/mod_magnet_cache.c6
-rw-r--r--src/mod_proxy.c20
-rw-r--r--src/mod_redirect.c10
-rw-r--r--src/mod_rewrite.c10
-rw-r--r--src/mod_rrdtool.c15
-rw-r--r--src/mod_scgi.c25
-rw-r--r--src/mod_secure_download.c10
-rw-r--r--src/mod_setenv.c6
-rw-r--r--src/mod_simple_vhost.c12
-rw-r--r--src/mod_skeleton.c10
-rw-r--r--src/mod_ssi.c26
-rw-r--r--src/mod_ssi_expr.c6
-rw-r--r--src/mod_ssi_exprparser.y8
-rw-r--r--src/mod_staticfile.c10
-rw-r--r--src/mod_status.c20
-rw-r--r--src/mod_trigger_b4_dl.c16
-rw-r--r--src/mod_uploadprogress.c8
-rw-r--r--src/mod_userdir.c12
-rw-r--r--src/mod_usertrack.c8
-rw-r--r--src/mod_webdav.c28
-rw-r--r--src/network.c22
-rw-r--r--src/network_backends.h3
-rw-r--r--src/network_freebsd_sendfile.c10
-rw-r--r--src/network_linux_sendfile.c11
-rw-r--r--src/network_openssl.c11
-rw-r--r--src/network_solaris_sendfilev.c12
-rw-r--r--src/network_write.c20
-rw-r--r--src/network_writev.c10
-rw-r--r--src/plugin.c13
-rw-r--r--src/proc_open.c11
-rw-r--r--src/request.c8
-rw-r--r--src/response.c22
-rw-r--r--src/response.h4
-rw-r--r--src/server.c46
-rw-r--r--src/splaytree.c2
-rw-r--r--src/stat_cache.c14
-rw-r--r--src/status_counter.c3
-rw-r--r--src/status_counter.h4
-rw-r--r--src/stream.c7
-rw-r--r--src/version.h4
98 files changed, 510 insertions, 570 deletions
diff --git a/src/array.c b/src/array.c
index ddcb5782..e93906b1 100644
--- a/src/array.c
+++ b/src/array.c
@@ -1,3 +1,6 @@
+#include "array.h"
+#include "buffer.h"
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -6,9 +9,6 @@
#include <errno.h>
#include <assert.h>
-#include "array.h"
-#include "buffer.h"
-
array *array_init(void) {
array *a;
diff --git a/src/array.h b/src/array.h
index 9b236998..84245c73 100644
--- a/src/array.h
+++ b/src/array.h
@@ -1,15 +1,18 @@
#ifndef ARRAY_H
#define ARRAY_H
-#include <stdlib.h>
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
+
#ifdef HAVE_PCRE_H
# include <pcre.h>
#endif
+
#include "buffer.h"
+#include <stdlib.h>
+
#define DATA_IS_STRING(x) (x->type == TYPE_STRING)
typedef enum { TYPE_UNSET, TYPE_STRING, TYPE_COUNT, TYPE_ARRAY, TYPE_INTEGER, TYPE_FASTCGI, TYPE_CONFIG } data_type_t;
diff --git a/src/base.h b/src/base.h
index 899882d4..c4583f49 100644
--- a/src/base.h
+++ b/src/base.h
@@ -1,18 +1,20 @@
#ifndef _BASE_H_
#define _BASE_H_
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <limits.h>
+
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
+
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
@@ -79,8 +81,6 @@ typedef int socklen_t;
# define SHUT_WR 1
#endif
-#include "settings.h"
-
typedef enum { T_CONFIG_UNSET,
T_CONFIG_STRING,
T_CONFIG_SHORT,
diff --git a/src/bitset.c b/src/bitset.c
index 7fe5662e..555f2449 100644
--- a/src/bitset.c
+++ b/src/bitset.c
@@ -1,12 +1,12 @@
+#include "buffer.h"
+#include "bitset.h"
+
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
-#include "bitset.h"
-#include "buffer.h"
-
#define BITSET_BITS \
( CHAR_BIT * sizeof(size_t) )
diff --git a/src/buffer.c b/src/buffer.c
index 7300d7ff..7520b1db 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,3 +1,5 @@
+#include "buffer.h"
+
#include <stdlib.h>
#include <string.h>
@@ -5,8 +7,6 @@
#include <assert.h>
#include <ctype.h>
-#include "buffer.h"
-
static const char hex_chars[] = "0123456789abcdef";
diff --git a/src/buffer.h b/src/buffer.h
index 571506e5..67a47ab8 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,15 +1,15 @@
#ifndef _BUFFER_H_
#define _BUFFER_H_
-#include <stdlib.h>
-#include <sys/types.h>
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "settings.h"
+#include <stdlib.h>
+#include <sys/types.h>
+
typedef struct {
char *ptr;
diff --git a/src/chunk.c b/src/chunk.c
index 6eb45c30..0cc26dad 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -4,6 +4,8 @@
*
*/
+#include "chunk.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
@@ -16,8 +18,6 @@
#include <errno.h>
#include <string.h>
-#include "chunk.h"
-
chunkqueue *chunkqueue_init(void) {
chunkqueue *cq;
diff --git a/src/configfile-glue.c b/src/configfile-glue.c
index 0a67c8f6..2904f711 100644
--- a/src/configfile-glue.c
+++ b/src/configfile-glue.c
@@ -1,6 +1,3 @@
-#include <string.h>
-#include <stdlib.h>
-
#include "base.h"
#include "buffer.h"
#include "array.h"
@@ -9,6 +6,9 @@
#include "configfile.h"
+#include <string.h>
+#include <stdlib.h>
+
/**
* like all glue code this file contains functions which
* are the external interface of lighttpd. The functions
diff --git a/src/configfile.c b/src/configfile.c
index 3dfc46ee..360b642d 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -1,3 +1,12 @@
+#include "server.h"
+#include "log.h"
+#include "stream.h"
+#include "plugin.h"
+
+#include "configparser.h"
+#include "configfile.h"
+#include "proc_open.h"
+
#include <sys/stat.h>
#include <stdlib.h>
@@ -10,18 +19,6 @@
#include <limits.h>
#include <assert.h>
-#include "server.h"
-#include "log.h"
-#include "stream.h"
-#include "plugin.h"
-#ifdef USE_LICENSE
-#include "license.h"
-#endif
-
-#include "configparser.h"
-#include "configfile.h"
-#include "proc_open.h"
-
static int config_insert(server *srv) {
size_t i;
diff --git a/src/configparser.y b/src/configparser.y
index b0042c5e..a52c0533 100644
--- a/src/configparser.y
+++ b/src/configparser.y
@@ -3,16 +3,14 @@
%name configparser
%include {
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#include "configfile.h"
#include "buffer.h"
#include "array.h"
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
static void configparser_push(config_t *ctx, data_config *dc, int isnew) {
if (isnew) {
dc->context_ndx = ctx->all_configs->used;
diff --git a/src/connections.c b/src/connections.c
index 60457d2b..7c35f0b8 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -1,13 +1,3 @@
-#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>
-
#include "buffer.h"
#include "server.h"
#include "log.h"
@@ -25,6 +15,16 @@
#include "inet_ntop_cache.h"
+#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 USE_OPENSSL
# include <openssl/ssl.h>
# include <openssl/err.h>
diff --git a/src/crc32.h b/src/crc32.h
index d671c537..c5b4245e 100644
--- a/src/crc32.h
+++ b/src/crc32.h
@@ -2,15 +2,15 @@
#define __crc32cr_table_h__
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#include <sys/types.h>
#if defined HAVE_STDINT_H
-#include <stdint.h>
+# include <stdint.h>
#elif defined HAVE_INTTYPES_H
-#include <inttypes.h>
+# include <inttypes.h>
#endif
uint32_t generate_crc32c(char *string, size_t length);
diff --git a/src/data_array.c b/src/data_array.c
index c07effb5..094d8c0f 100644
--- a/src/data_array.c
+++ b/src/data_array.c
@@ -1,9 +1,9 @@
+#include "array.h"
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include "array.h"
-
static data_unset *data_array_copy(const data_unset *s) {
data_array *src = (data_array *)s;
data_array *ds = data_array_init();
diff --git a/src/data_config.c b/src/data_config.c
index a3b8cffa..80e38de1 100644
--- a/src/data_config.c
+++ b/src/data_config.c
@@ -1,9 +1,9 @@
+#include "array.h"
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include "array.h"
-
static data_unset *data_config_copy(const data_unset *s) {
data_config *src = (data_config *)s;
data_config *ds = data_config_init();
diff --git a/src/data_count.c b/src/data_count.c
index 5c5a5f06..8d36c8b3 100644
--- a/src/data_count.c
+++ b/src/data_count.c
@@ -1,9 +1,9 @@
+#include "array.h"
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include "array.h"
-
static data_unset *data_count_copy(const data_unset *s) {
data_count *src = (data_count *)s;
data_count *ds = data_count_init();
diff --git a/src/data_fastcgi.c b/src/data_fastcgi.c
index 83e92660..e13a470c 100644
--- a/src/data_fastcgi.c
+++ b/src/data_fastcgi.c
@@ -1,10 +1,10 @@
+#include "array.h"
+#include "fastcgi.h"
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include "array.h"
-#include "fastcgi.h"
-
static data_unset *data_fastcgi_copy(const data_unset *s) {
data_fastcgi *src = (data_fastcgi *)s;
data_fastcgi *ds = data_fastcgi_init();
diff --git a/src/data_integer.c b/src/data_integer.c
index 54234077..63cbb100 100644
--- a/src/data_integer.c
+++ b/src/data_integer.c
@@ -1,9 +1,9 @@
+#include "array.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "array.h"
-
static data_unset *data_integer_copy(const data_unset *s) {
data_integer *src = (data_integer *)s;
data_integer *ds = data_integer_init();
diff --git a/src/data_string.c b/src/data_string.c
index 5b2678d8..919550ba 100644
--- a/src/data_string.c
+++ b/src/data_string.c
@@ -1,10 +1,10 @@
+#include "array.h"
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
-#include "array.h"
-
static data_unset *data_string_copy(const data_unset *s) {
data_string *src = (data_string *)s;
data_string *ds = data_string_init();
diff --git a/src/etag.c b/src/etag.c
index c44278b8..9ff585fe 100644
--- a/src/etag.c
+++ b/src/etag.c
@@ -1,17 +1,13 @@
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "buffer.h"
+#include "etag.h"
#if defined HAVE_STDINT_H
-#include <stdint.h>
+# include <stdint.h>
#elif defined HAVE_INTTYPES_H
-#include <inttypes.h>
+# include <inttypes.h>
#endif
-#include "buffer.h"
-#include "etag.h"
+#include <string.h>
int etag_is_equal(buffer *etag, const char *matches) {
if (etag && !buffer_is_empty(etag) && 0 == strcmp(etag->ptr, matches)) return 1;
diff --git a/src/etag.h b/src/etag.h
index 5fefe0f0..97cb0631 100644
--- a/src/etag.h
+++ b/src/etag.h
@@ -1,12 +1,12 @@
#ifndef ETAG_H
#define ETAG_H
+#include "buffer.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include "buffer.h"
-
typedef enum { ETAG_USE_INODE = 1, ETAG_USE_MTIME = 2, ETAG_USE_SIZE = 4 } etag_flags_t;
int etag_is_equal(buffer *etag, const char *matches);
diff --git a/src/fdevent.c b/src/fdevent.c
index 92ff0e94..de9ee916 100644
--- a/src/fdevent.c
+++ b/src/fdevent.c
@@ -1,6 +1,7 @@
-#include <sys/types.h>
+#include "fdevent.h"
+#include "buffer.h"
-#include "settings.h"
+#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
@@ -9,8 +10,6 @@
#include <stdio.h>
#include <fcntl.h>
-#include "fdevent.h"
-#include "buffer.h"
fdevents *fdevent_init(size_t maxfds, fdevent_handler_t type) {
fdevents *ev;
diff --git a/src/fdevent.h b/src/fdevent.h
index 5629e9cb..d6ee3f2f 100644
--- a/src/fdevent.h
+++ b/src/fdevent.h
@@ -2,8 +2,9 @@
#define _FDEVENT_H_
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
+
#include "settings.h"
#include "bitset.h"
diff --git a/src/fdevent_freebsd_kqueue.c b/src/fdevent_freebsd_kqueue.c
index e21d6fd9..948d52cb 100644
--- a/src/fdevent_freebsd_kqueue.c
+++ b/src/fdevent_freebsd_kqueue.c
@@ -1,3 +1,7 @@
+#include "fdevent.h"
+#include "buffer.h"
+#include "server.h"
+
#include <sys/types.h>
#include <unistd.h>
@@ -8,11 +12,6 @@
#include <signal.h>
#include <fcntl.h>
-#include "fdevent.h"
-#include "settings.h"
-#include "buffer.h"
-#include "server.h"
-
#ifdef USE_FREEBSD_KQUEUE
#include <sys/event.h>
#include <sys/time.h>
diff --git a/src/fdevent_linux_rtsig.c b/src/fdevent_linux_rtsig.c
index 924e4c79..624c9809 100644
--- a/src/fdevent_linux_rtsig.c
+++ b/src/fdevent_linux_rtsig.c
@@ -1,3 +1,6 @@
+#include "fdevent.h"
+#include "buffer.h"
+
#include <sys/types.h>
#include <unistd.h>
@@ -8,13 +11,8 @@
#include <signal.h>
#include <limits.h>
-#define __USE_GNU
#include <fcntl.h>
-#include "fdevent.h"
-#include "settings.h"
-#include "buffer.h"
-
#ifdef USE_LINUX_SIGIO
static void fdevent_linux_rtsig_free(fdevents *ev) {
free(ev->pollfds);
diff --git a/src/fdevent_linux_sysepoll.c b/src/fdevent_linux_sysepoll.c
index eb3ce117..a00fdd3b 100644
--- a/src/fdevent_linux_sysepoll.c
+++ b/src/fdevent_linux_sysepoll.c
@@ -1,3 +1,6 @@
+#include "fdevent.h"
+#include "buffer.h"
+
#include <sys/types.h>
#include <unistd.h>
@@ -8,10 +11,6 @@
#include <signal.h>
#include <fcntl.h>
-#include "fdevent.h"
-#include "settings.h"
-#include "buffer.h"
-
#ifdef USE_LINUX_EPOLL
static void fdevent_linux_sysepoll_free(fdevents *ev) {
close(ev->epoll_fd);
diff --git a/src/fdevent_poll.c b/src/fdevent_poll.c
index 88c4f189..6e63bd0b 100644
--- a/src/fdevent_poll.c
+++ b/src/fdevent_poll.c
@@ -1,3 +1,6 @@
+#include "fdevent.h"
+#include "buffer.h"
+
#include <sys/types.h>
#include <unistd.h>
@@ -8,10 +11,6 @@
#include <signal.h>
#include <fcntl.h>
-#include "fdevent.h"
-#include "settings.h"
-#include "buffer.h"
-
#ifdef USE_POLL
static void fdevent_poll_free(fdevents *ev) {
free(ev->pollfds);
diff --git a/src/fdevent_select.c b/src/fdevent_select.c
index 079e794e..4a324201 100644
--- a/src/fdevent_select.c
+++ b/src/fdevent_select.c
@@ -1,3 +1,6 @@
+#include "fdevent.h"
+#include "buffer.h"
+
#include <sys/time.h>
#include <sys/types.h>
@@ -9,10 +12,6 @@
#include <fcntl.h>
#include <assert.h>
-#include "fdevent.h"
-#include "settings.h"
-#include "buffer.h"
-
#ifdef USE_SELECT
static int fdevent_select_reset(fdevents *ev) {
diff --git a/src/fdevent_solaris_devpoll.c b/src/fdevent_solaris_devpoll.c
index 76414a46..c099b12d 100644
--- a/src/fdevent_solaris_devpoll.c
+++ b/src/fdevent_solaris_devpoll.c
@@ -1,3 +1,6 @@
+#include "fdevent.h"
+#include "buffer.h"
+
#include <sys/types.h>
#include <unistd.h>
@@ -8,10 +11,6 @@
#include <signal.h>
#include <fcntl.h>
-#include "fdevent.h"
-#include "settings.h"
-#include "buffer.h"
-
#ifdef USE_SOLARIS_DEVPOLL
static void fdevent_solaris_devpoll_free(fdevents *ev) {
diff --git a/src/http-header-glue.c b/src/http-header-glue.c
index 9b7d6b9a..9bc416db 100644
--- a/src/http-header-glue.c
+++ b/src/http-header-glue.c
@@ -1,9 +1,3 @@
-#define _GNU_SOURCE
-
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-
#include "base.h"
#include "array.h"
#include "buffer.h"
@@ -11,6 +5,10 @@
#include "etag.h"
#include "response.h"
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
/*
* This was 'borrowed' from tcpdump.
*
diff --git a/src/http_auth.c b/src/http_auth.c
index 4b7e75a8..0c0c4a58 100644
--- a/src/http_auth.c
+++ b/src/http_auth.c
@@ -1,6 +1,9 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "server.h"
+#include "log.h"
+#include "http_auth.h"
+#include "http_auth_digest.h"
+#include "inet_ntop_cache.h"
+#include "stream.h"
#ifdef HAVE_CRYPT_H
# include <crypt.h>
@@ -25,13 +28,6 @@
#include <unistd.h>
#include <ctype.h>
-#include "server.h"
-#include "log.h"
-#include "http_auth.h"
-#include "http_auth_digest.h"
-#include "inet_ntop_cache.h"
-#include "stream.h"
-
#ifdef USE_OPENSSL
# include <openssl/md5.h>
#else
diff --git a/src/http_auth_digest.c b/src/http_auth_digest.c
index e440430d..e3f46b64 100644
--- a/src/http_auth_digest.c
+++ b/src/http_auth_digest.c
@@ -1,7 +1,8 @@
-#include <string.h>
+#include "buffer.h"
+
#include "http_auth_digest.h"
-#include "buffer.h"
+#include <string.h>
#ifndef USE_OPENSSL
# include "md5.h"
diff --git a/src/http_auth_digest.h b/src/http_auth_digest.h
index 25d95ee4..58e8cb56 100644
--- a/src/http_auth_digest.h
+++ b/src/http_auth_digest.h
@@ -2,7 +2,7 @@
#define _DIGCALC_H_
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#define HASHLEN 16
diff --git a/src/http_chunk.c b/src/http_chunk.c
index 37e829d4..5557edc3 100644
--- a/src/http_chunk.c
+++ b/src/http_chunk.c
@@ -4,6 +4,11 @@
*
*/
+#include "server.h"
+#include "chunk.h"
+#include "http_chunk.h"
+#include "log.h"
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -15,11 +20,6 @@
#include <errno.h>
#include <string.h>
-#include "server.h"
-#include "chunk.h"
-#include "http_chunk.h"
-#include "log.h"
-
static int http_chunk_append_len(server *srv, connection *con, size_t len) {
size_t i, olen = len, j;
buffer *b;
diff --git a/src/inet_ntop_cache.c b/src/inet_ntop_cache.c
index 51755df3..eac0681d 100644
--- a/src/inet_ntop_cache.c
+++ b/src/inet_ntop_cache.c
@@ -1,12 +1,11 @@
-#include <sys/types.h>
-
-#include <string.h>
-
-
#include "base.h"
#include "inet_ntop_cache.h"
#include "sys-socket.h"
+#include <sys/types.h>
+
+#include <string.h>
+
const char * inet_ntop_cache_get_ip(server *srv, sock_addr *addr) {
#ifdef HAVE_IPV6
size_t ndx = 0, i;
diff --git a/src/joblist.c b/src/joblist.c
index 4ce38422..677a1a5e 100644
--- a/src/joblist.c
+++ b/src/joblist.c
@@ -1,10 +1,10 @@
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "joblist.h"
#include "log.h"
+#include <stdlib.h>
+#include <string.h>
+
int joblist_append(server *srv, connection *con) {
if (con->in_joblist) return 0;
diff --git a/src/keyvalue.c b/src/keyvalue.c
index ae5df2f1..00f6ef61 100644
--- a/src/keyvalue.c
+++ b/src/keyvalue.c
@@ -1,10 +1,10 @@
+#include "server.h"
+#include "keyvalue.h"
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include "server.h"
-#include "keyvalue.h"
-
static keyvalue http_versions[] = {
{ HTTP_VERSION_1_1, "HTTP/1.1" },
{ HTTP_VERSION_1_0, "HTTP/1.0" },
diff --git a/src/keyvalue.h b/src/keyvalue.h
index 1f378370..b2b178a4 100644
--- a/src/keyvalue.h
+++ b/src/keyvalue.h
@@ -2,7 +2,7 @@
#define _KEY_VALUE_H_
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#ifdef HAVE_PCRE_H
diff --git a/src/log.c b/src/log.c
index 2250f4c3..10db6354 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,4 +1,6 @@
-#define _GNU_SOURCE
+#include "base.h"
+#include "log.h"
+#include "array.h"
#include <sys/types.h>
@@ -12,19 +14,12 @@
#include <stdarg.h>
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
+# include <syslog.h>
#endif
-#include "log.h"
-#include "array.h"
-
#ifdef HAVE_VALGRIND_VALGRIND_H
-#include <valgrind/valgrind.h>
+# include <valgrind/valgrind.h>
#endif
#ifndef O_LARGEFILE
diff --git a/src/md5.c b/src/md5.c
index 59066bc3..34c6ac9a 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -24,7 +24,7 @@ documentation and/or software.
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#ifndef USE_OPENSSL
diff --git a/src/mod_access.c b/src/mod_access.c
index 12b4d97f..39024350 100644
--- a/src/mod_access.c
+++ b/src/mod_access.c
@@ -1,13 +1,13 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
typedef struct {
array *access_deny;
} plugin_config;
diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c
index 024f2e9f..5a859c5c 100644
--- a/src/mod_accesslog.c
+++ b/src/mod_accesslog.c
@@ -1,4 +1,12 @@
-#define _GNU_SOURCE
+#include "base.h"
+#include "log.h"
+#include "buffer.h"
+
+#include "plugin.h"
+
+#include "inet_ntop_cache.h"
+
+#include "sys-socket.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -13,16 +21,6 @@
#include <stdio.h>
-#include "base.h"
-#include "log.h"
-#include "buffer.h"
-
-#include "plugin.h"
-
-#include "inet_ntop_cache.h"
-
-#include "sys-socket.h"
-
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
diff --git a/src/mod_alias.c b/src/mod_alias.c
index 933338d2..5b7b5107 100644
--- a/src/mod_alias.c
+++ b/src/mod_alias.c
@@ -1,14 +1,14 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
/* plugin config for all request/connections */
typedef struct {
array *alias;
diff --git a/src/mod_auth.c b/src/mod_auth.c
index e4268313..0abde92f 100644
--- a/src/mod_auth.c
+++ b/src/mod_auth.c
@@ -1,3 +1,8 @@
+#include "plugin.h"
+#include "http_auth.h"
+#include "log.h"
+#include "response.h"
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -7,11 +12,6 @@
#include <fcntl.h>
#include <unistd.h>
-#include "plugin.h"
-#include "http_auth.h"
-#include "log.h"
-#include "response.h"
-
handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s);
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index 15ecd10f..47bbbbe4 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -1,14 +1,23 @@
+#include "server.h"
+#include "stat_cache.h"
+#include "keyvalue.h"
+#include "log.h"
+#include "connections.h"
+#include "joblist.h"
+#include "http_chunk.h"
+
+#include "plugin.h"
+
#include <sys/types.h>
+
#ifdef __WIN32
-#include <winsock2.h>
+# include <winsock2.h>
#else
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-
-#include <netinet/in.h>
-
-#include <arpa/inet.h>
+# include <sys/socket.h>
+# include <sys/wait.h>
+# include <sys/mman.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
#endif
#include <unistd.h>
@@ -23,16 +32,6 @@
#include <stdio.h>
#include <fcntl.h>
-#include "server.h"
-#include "stat_cache.h"
-#include "keyvalue.h"
-#include "log.h"
-#include "connections.h"
-#include "joblist.h"
-#include "http_chunk.h"
-
-#include "plugin.h"
-
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
diff --git a/src/mod_cml.c b/src/mod_cml.c
index 03e264ce..f83eb803 100644
--- a/src/mod_cml.c
+++ b/src/mod_cml.c
@@ -1,12 +1,3 @@
-#include <sys/stat.h>
-#include <time.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-
#include "buffer.h"
#include "server.h"
#include "log.h"
@@ -17,6 +8,15 @@
#include "mod_cml.h"
+#include <sys/stat.h>
+#include <time.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+
/* init the plugin data */
INIT_FUNC(mod_cml_init) {
plugin_data *p;
diff --git a/src/mod_cml_funcs.c b/src/mod_cml_funcs.c
index 82bca101..b01d4d22 100644
--- a/src/mod_cml_funcs.c
+++ b/src/mod_cml_funcs.c
@@ -1,3 +1,12 @@
+#include "buffer.h"
+#include "server.h"
+#include "log.h"
+#include "plugin.h"
+#include "response.h"
+
+#include "mod_cml.h"
+#include "mod_cml_funcs.h"
+
#include <sys/stat.h>
#include <time.h>
@@ -8,15 +17,6 @@
#include <dirent.h>
#include <stdio.h>
-#include "buffer.h"
-#include "server.h"
-#include "log.h"
-#include "plugin.h"
-#include "response.h"
-
-#include "mod_cml.h"
-#include "mod_cml_funcs.h"
-
#ifdef USE_OPENSSL
# include <openssl/md5.h>
#else
diff --git a/src/mod_cml_funcs.h b/src/mod_cml_funcs.h
index 42e067ce..f0695d7c 100644
--- a/src/mod_cml_funcs.h
+++ b/src/mod_cml_funcs.h
@@ -2,7 +2,7 @@
#define _MOD_CML_FUNCS_H_
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#ifdef HAVE_LUA_H
diff --git a/src/mod_cml_lua.c b/src/mod_cml_lua.c
index 4c2801b4..b3f2cbb4 100644
--- a/src/mod_cml_lua.c
+++ b/src/mod_cml_lua.c
@@ -1,9 +1,3 @@
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-
#include "mod_cml.h"
#include "mod_cml_funcs.h"
#include "log.h"
@@ -11,6 +5,12 @@
#include "stat_cache.h"
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+
#ifdef USE_OPENSSL
# include <openssl/md5.h>
#else
diff --git a/src/mod_compress.c b/src/mod_compress.c
index 4b339830..f53174d8 100644
--- a/src/mod_compress.c
+++ b/src/mod_compress.c
@@ -1,14 +1,3 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -20,6 +9,17 @@
#include "crc32.h"
#include "etag.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
#if defined HAVE_ZLIB_H && defined HAVE_LIBZ
# define USE_ZLIB
# include <zlib.h>
@@ -42,7 +42,7 @@
#define HTTP_ACCEPT_ENCODING_BZIP2 BV(4)
#ifdef __WIN32
-#define mkdir(x,y) mkdir(x)
+# define mkdir(x,y) mkdir(x)
#endif
typedef struct {
diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c
index 0fa24659..4adc8792 100644
--- a/src/mod_dirlisting.c
+++ b/src/mod_dirlisting.c
@@ -1,13 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <time.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -18,6 +8,16 @@
#include "stat_cache.h"
#include "stream.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dirent.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+
/**
* this is a dirlisting for a lighttpd plugin
*/
diff --git a/src/mod_evasive.c b/src/mod_evasive.c
index 467bada7..29070538 100644
--- a/src/mod_evasive.c
+++ b/src/mod_evasive.c
@@ -1,7 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -10,6 +6,10 @@
#include "inet_ntop_cache.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
/**
* mod_evasive
*
diff --git a/src/mod_evhost.c b/src/mod_evhost.c
index 75530467..7aabf6e0 100644
--- a/src/mod_evhost.c
+++ b/src/mod_evhost.c
@@ -1,12 +1,12 @@
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
#include "plugin.h"
#include "log.h"
#include "response.h"
#include "stat_cache.h"
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+
typedef struct {
/* unparsed pieces */
buffer *path_pieces_raw;
diff --git a/src/mod_expire.c b/src/mod_expire.c
index 32177060..734cb930 100644
--- a/src/mod_expire.c
+++ b/src/mod_expire.c
@@ -1,8 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -11,6 +6,11 @@
#include "plugin.h"
#include "stat_cache.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
/**
* this is a expire module for a lighttpd
*
diff --git a/src/mod_extforward.c b/src/mod_extforward.c
index aabee124..afcc5599 100644
--- a/src/mod_extforward.c
+++ b/src/mod_extforward.c
@@ -1,3 +1,12 @@
+#include "base.h"
+#include "log.h"
+#include "buffer.h"
+
+#include "plugin.h"
+
+#include "inet_ntop_cache.h"
+#include "configfile.h"
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -8,15 +17,6 @@
#include <stdio.h>
#include <netinet/in.h>
-#include "base.h"
-#include "log.h"
-#include "buffer.h"
-
-#include "plugin.h"
-
-#include "inet_ntop_cache.h"
-#include "configfile.h"
-
/**
* mod_extforward.c for lighttpd, by comman.kang <at> gmail <dot> com
* extended, modified by Lionel Elie Mamane (LEM), lionel <at> mamane <dot> lu
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index 6d254ba0..a9d413fb 100644
--- a/src/mod_fastcgi.c
+++ b/src/mod_fastcgi.c
@@ -1,13 +1,3 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <signal.h>
-
#include "buffer.h"
#include "server.h"
#include "keyvalue.h"
@@ -25,15 +15,26 @@
#include "stat_cache.h"
#include "status_counter.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <signal.h>
+
#ifdef HAVE_FASTCGI_FASTCGI_H
-#include <fastcgi/fastcgi.h>
-#else
-#ifdef HAVE_FASTCGI_H
-#include <fastcgi.h>
+# include <fastcgi/fastcgi.h>
#else
-#include "fastcgi.h"
-#endif
+# ifdef HAVE_FASTCGI_H
+# include <fastcgi.h>
+# else
+# include "fastcgi.h"
+# endif
#endif /* HAVE_FASTCGI_FASTCGI_H */
+
#include <stdio.h>
#ifdef HAVE_SYS_FILIO_H
diff --git a/src/mod_flv_streaming.c b/src/mod_flv_streaming.c
index f8bf9999..7a100dbd 100644
--- a/src/mod_flv_streaming.c
+++ b/src/mod_flv_streaming.c
@@ -1,7 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -11,9 +7,9 @@
#include "plugin.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
/* plugin config for all request/connections */
diff --git a/src/mod_indexfile.c b/src/mod_indexfile.c
index d133474a..c01da2f1 100644
--- a/src/mod_indexfile.c
+++ b/src/mod_indexfile.c
@@ -1,9 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -12,6 +6,11 @@
#include "stat_cache.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
/* plugin config for all request/connections */
typedef struct {
diff --git a/src/mod_magnet.c b/src/mod_magnet.c
index 50b657ac..81cda8d7 100644
--- a/src/mod_magnet.c
+++ b/src/mod_magnet.c
@@ -1,9 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <setjmp.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -16,6 +10,12 @@
#include "status_counter.h"
#include "etag.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <setjmp.h>
+
#ifdef HAVE_LUA_H
#include <lua.h>
#include <lauxlib.h>
diff --git a/src/mod_magnet_cache.c b/src/mod_magnet_cache.c
index 1e4840fc..50326cf8 100644
--- a/src/mod_magnet_cache.c
+++ b/src/mod_magnet_cache.c
@@ -1,10 +1,10 @@
+#include "mod_magnet_cache.h"
+#include "stat_cache.h"
+
#include <stdlib.h>
#include <time.h>
#include <assert.h>
-#include "mod_magnet_cache.h"
-#include "stat_cache.h"
-
#ifdef HAVE_LUA_H
#include <lualib.h>
#include <lauxlib.h>
diff --git a/src/mod_proxy.c b/src/mod_proxy.c
index 258890c8..33ac1d8d 100644
--- a/src/mod_proxy.c
+++ b/src/mod_proxy.c
@@ -1,13 +1,3 @@
-#include <sys/types.h>
-
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-
#include "buffer.h"
#include "server.h"
#include "keyvalue.h"
@@ -24,6 +14,16 @@
#include "inet_ntop_cache.h"
#include "crc32.h"
+#include <sys/types.h>
+
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+
#include <stdio.h>
#ifdef HAVE_SYS_FILIO_H
diff --git a/src/mod_redirect.c b/src/mod_redirect.c
index f8efcfc0..7a0f82a1 100644
--- a/src/mod_redirect.c
+++ b/src/mod_redirect.c
@@ -1,7 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -9,9 +5,9 @@
#include "plugin.h"
#include "response.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
typedef struct {
pcre_keyvalue_buffer *redirect;
diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c
index b1c462bf..81f49676 100644
--- a/src/mod_rewrite.c
+++ b/src/mod_rewrite.c
@@ -1,16 +1,12 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
typedef struct {
#ifdef HAVE_PCRE_H
diff --git a/src/mod_rrdtool.c b/src/mod_rrdtool.c
index b3a3fcf0..9ebc201a 100644
--- a/src/mod_rrdtool.c
+++ b/src/mod_rrdtool.c
@@ -1,4 +1,10 @@
-#define _GNU_SOURCE
+#include "server.h"
+#include "connections.h"
+#include "response.h"
+#include "connections.h"
+#include "log.h"
+
+#include "plugin.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -9,13 +15,6 @@
#include <errno.h>
#include <time.h>
-#include "server.h"
-#include "connections.h"
-#include "response.h"
-#include "connections.h"
-#include "log.h"
-
-#include "plugin.h"
#ifdef HAVE_FORK
/* no need for waitpid if we don't have fork */
#include <sys/wait.h>
diff --git a/src/mod_scgi.c b/src/mod_scgi.c
index bcabc23b..3702bd2b 100644
--- a/src/mod_scgi.c
+++ b/src/mod_scgi.c
@@ -1,13 +1,3 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <signal.h>
-
#include "buffer.h"
#include "server.h"
#include "keyvalue.h"
@@ -23,6 +13,16 @@
#include "inet_ntop_cache.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <signal.h>
+
#include <stdio.h>
#ifdef HAVE_SYS_FILIO_H
@@ -32,10 +32,11 @@
#include "sys-socket.h"
#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
+# include <sys/uio.h>
#endif
+
#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
+# include <sys/wait.h>
#endif
#include "version.h"
diff --git a/src/mod_secure_download.c b/src/mod_secure_download.c
index acafff7f..67013c3b 100644
--- a/src/mod_secure_download.c
+++ b/src/mod_secure_download.c
@@ -1,16 +1,12 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef USE_OPENSSL
# include <openssl/md5.h>
diff --git a/src/mod_setenv.c b/src/mod_setenv.c
index 36ed617d..4419b61f 100644
--- a/src/mod_setenv.c
+++ b/src/mod_setenv.c
@@ -1,6 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -9,6 +6,9 @@
#include "response.h"
+#include <stdlib.h>
+#include <string.h>
+
/* plugin config for all request/connections */
typedef struct {
diff --git a/src/mod_simple_vhost.c b/src/mod_simple_vhost.c
index 21d01070..bbb61d52 100644
--- a/src/mod_simple_vhost.c
+++ b/src/mod_simple_vhost.c
@@ -1,8 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -10,9 +5,10 @@
#include "plugin.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
typedef struct {
buffer *server_root;
diff --git a/src/mod_skeleton.c b/src/mod_skeleton.c
index 0ce833f5..66de2b1f 100644
--- a/src/mod_skeleton.c
+++ b/src/mod_skeleton.c
@@ -1,16 +1,12 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
/**
* this is a skeleton for a lighttpd plugin
diff --git a/src/mod_ssi.c b/src/mod_ssi.c
index e5a927dd..897f49ea 100644
--- a/src/mod_ssi.c
+++ b/src/mod_ssi.c
@@ -1,13 +1,3 @@
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-#include <unistd.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -24,16 +14,26 @@
#include "sys-socket.h"
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+
#ifdef HAVE_PWD_H
-#include <pwd.h>
+# include <pwd.h>
#endif
#ifdef HAVE_FORK
-#include <sys/wait.h>
+# include <sys/wait.h>
#endif
#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
+# include <sys/filio.h>
#endif
#include "etag.h"
diff --git a/src/mod_ssi_expr.c b/src/mod_ssi_expr.c
index b560f793..c5d85818 100644
--- a/src/mod_ssi_expr.c
+++ b/src/mod_ssi_expr.c
@@ -1,12 +1,12 @@
-#include <ctype.h>
-#include <string.h>
-
#include "buffer.h"
#include "log.h"
#include "mod_ssi.h"
#include "mod_ssi_expr.h"
#include "mod_ssi_exprparser.h"
+#include <ctype.h>
+#include <string.h>
+
typedef struct {
const char *input;
size_t offset;
diff --git a/src/mod_ssi_exprparser.y b/src/mod_ssi_exprparser.y
index f3d4a570..f4aaa967 100644
--- a/src/mod_ssi_exprparser.y
+++ b/src/mod_ssi_exprparser.y
@@ -4,13 +4,11 @@
%name ssiexprparser
%include {
-#include <assert.h>
-#include <string.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#include "mod_ssi_expr.h"
#include "buffer.h"
+
+#include <assert.h>
+#include <string.h>
}
%parse_failure {
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index df19d67f..41dc6a2e 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -1,8 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -14,6 +9,11 @@
#include "http_chunk.h"
#include "response.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
/**
* this is a staticfile for a lighttpd plugin
*
diff --git a/src/mod_status.c b/src/mod_status.c
index c9927497..df5bdb8e 100644
--- a/src/mod_status.c
+++ b/src/mod_status.c
@@ -1,4 +1,13 @@
-#define _GNU_SOURCE
+#include "server.h"
+#include "connections.h"
+#include "response.h"
+#include "connections.h"
+#include "log.h"
+
+#include "plugin.h"
+
+#include "inet_ntop_cache.h"
+
#include <sys/types.h>
#include <fcntl.h>
@@ -9,15 +18,6 @@
#include <time.h>
#include <stdio.h>
-#include "server.h"
-#include "connections.h"
-#include "response.h"
-#include "connections.h"
-#include "log.h"
-
-#include "plugin.h"
-
-#include "inet_ntop_cache.h"
#include "version.h"
typedef struct {
diff --git a/src/mod_trigger_b4_dl.c b/src/mod_trigger_b4_dl.c
index 44f5db69..f813413c 100644
--- a/src/mod_trigger_b4_dl.c
+++ b/src/mod_trigger_b4_dl.c
@@ -1,8 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -11,16 +6,21 @@
#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)
-#include <gdbm.h>
+# include <gdbm.h>
#endif
#if defined(HAVE_PCRE_H)
-#include <pcre.h>
+# include <pcre.h>
#endif
#if defined(HAVE_MEMCACHE_H)
-#include <memcache.h>
+# include <memcache.h>
#endif
/**
diff --git a/src/mod_uploadprogress.c b/src/mod_uploadprogress.c
index a786d074..7744057e 100644
--- a/src/mod_uploadprogress.c
+++ b/src/mod_uploadprogress.c
@@ -1,7 +1,3 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -11,6 +7,10 @@
#include "response.h"
#include "stat_cache.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
/**
* this is a uploadprogress for a lighttpd plugin
*
diff --git a/src/mod_userdir.c b/src/mod_userdir.c
index ebdabc75..f0fc005e 100644
--- a/src/mod_userdir.c
+++ b/src/mod_userdir.c
@@ -1,8 +1,3 @@
-#include <sys/types.h>
-
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
@@ -11,8 +6,13 @@
#include "plugin.h"
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <string.h>
+
#ifdef HAVE_PWD_H
-#include <pwd.h>
+# include <pwd.h>
#endif
/* plugin config for all request/connections */
diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c
index 246bb980..d72d1e1d 100644
--- a/src/mod_usertrack.c
+++ b/src/mod_usertrack.c
@@ -1,13 +1,13 @@
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
#ifdef USE_OPENSSL
# include <openssl/md5.h>
#else
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index 674efa3a..914f191d 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -1,3 +1,15 @@
+#include "base.h"
+#include "log.h"
+#include "buffer.h"
+#include "response.h"
+
+#include "plugin.h"
+
+#include "stream.h"
+#include "stat_cache.h"
+
+#include "sys-mmap.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
@@ -11,10 +23,6 @@
#include <unistd.h>
#include <dirent.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#if defined(HAVE_LIBXML_H) && defined(HAVE_SQLITE3_H)
#define USE_PROPPATCH
#include <libxml/tree.h>
@@ -28,18 +36,6 @@
#include <uuid/uuid.h>
#endif
-#include "base.h"
-#include "log.h"
-#include "buffer.h"
-#include "response.h"
-
-#include "plugin.h"
-
-#include "stream.h"
-#include "stat_cache.h"
-
-#include "sys-mmap.h"
-
/**
* this is a webdav for a lighttpd plugin
*
diff --git a/src/network.c b/src/network.c
index 20aec47e..5b49a749 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1,14 +1,3 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
#include "network.h"
#include "fdevent.h"
#include "log.h"
@@ -20,6 +9,17 @@
#include "sys-mmap.h"
#include "sys-socket.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
#ifdef USE_OPENSSL
# include <openssl/ssl.h>
# include <openssl/err.h>
diff --git a/src/network_backends.h b/src/network_backends.h
index 4b4972e2..8d92006c 100644
--- a/src/network_backends.h
+++ b/src/network_backends.h
@@ -2,8 +2,9 @@
#define _NETWORK_BACKENDS_H_
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
+#include "settings.h"
#include <sys/types.h>
diff --git a/src/network_freebsd_sendfile.c b/src/network_freebsd_sendfile.c
index 9bdd2a97..ba92aaf5 100644
--- a/src/network_freebsd_sendfile.c
+++ b/src/network_freebsd_sendfile.c
@@ -2,6 +2,11 @@
#ifdef USE_FREEBSD_SENDFILE
+#include "network.h"
+#include "fdevent.h"
+#include "log.h"
+#include "stat_cache.h"
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -18,11 +23,6 @@
#include <string.h>
#include <stdlib.h>
-#include "network.h"
-#include "fdevent.h"
-#include "log.h"
-#include "stat_cache.h"
-
#ifndef UIO_MAXIOV
# if defined(__FreeBSD__) || defined(__DragonFly__)
diff --git a/src/network_linux_sendfile.c b/src/network_linux_sendfile.c
index 5f018127..5a44b47c 100644
--- a/src/network_linux_sendfile.c
+++ b/src/network_linux_sendfile.c
@@ -1,6 +1,12 @@
#include "network_backends.h"
#ifdef USE_LINUX_SENDFILE
+
+#include "network.h"
+#include "fdevent.h"
+#include "log.h"
+#include "stat_cache.h"
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -18,11 +24,6 @@
#include <stdlib.h>
#include <fcntl.h>
-#include "network.h"
-#include "fdevent.h"
-#include "log.h"
-#include "stat_cache.h"
-
/* on linux 2.4.29 + debian/ubuntu we have crashes if this is enabled */
#undef HAVE_POSIX_FADVISE
diff --git a/src/network_openssl.c b/src/network_openssl.c
index 756ce193..d2fb6d8b 100644
--- a/src/network_openssl.c
+++ b/src/network_openssl.c
@@ -1,6 +1,12 @@
#include "network_backends.h"
#ifdef USE_OPENSSL
+
+#include "network.h"
+#include "fdevent.h"
+#include "log.h"
+#include "stat_cache.h"
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -18,11 +24,6 @@
#include <stdlib.h>
#include <assert.h>
-#include "network.h"
-#include "fdevent.h"
-#include "log.h"
-#include "stat_cache.h"
-
# include <openssl/ssl.h>
# include <openssl/err.h>
diff --git a/src/network_solaris_sendfilev.c b/src/network_solaris_sendfilev.c
index fcb7d10c..fcfa178a 100644
--- a/src/network_solaris_sendfilev.c
+++ b/src/network_solaris_sendfilev.c
@@ -2,6 +2,11 @@
#ifdef USE_SOLARIS_SENDFILEV
+#include "network.h"
+#include "fdevent.h"
+#include "log.h"
+#include "stat_cache.h"
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -19,13 +24,8 @@
#include <stdlib.h>
#include <limits.h>
-#include "network.h"
-#include "fdevent.h"
-#include "log.h"
-#include "stat_cache.h"
-
#ifndef UIO_MAXIOV
-#define UIO_MAXIOV IOV_MAX
+# define UIO_MAXIOV IOV_MAX
#endif
/**
diff --git a/src/network_write.c b/src/network_write.c
index 81f9dd8e..b5c89f5d 100644
--- a/src/network_write.c
+++ b/src/network_write.c
@@ -1,11 +1,4 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
+#include "network_backends.h"
#include "network.h"
#include "fdevent.h"
@@ -14,14 +7,21 @@
#include "sys-socket.h"
-#include "network_backends.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
+# include <sys/resource.h>
#endif
int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqueue *cq) {
diff --git a/src/network_writev.c b/src/network_writev.c
index 4c2684fe..6a193482 100644
--- a/src/network_writev.c
+++ b/src/network_writev.c
@@ -2,6 +2,11 @@
#ifdef USE_WRITEV
+#include "network.h"
+#include "fdevent.h"
+#include "log.h"
+#include "stat_cache.h"
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
@@ -21,11 +26,6 @@
#include <stdio.h>
#include <assert.h>
-#include "network.h"
-#include "fdevent.h"
-#include "log.h"
-#include "stat_cache.h"
-
#if 0
#define LOCAL_BUFFERING 1
#endif
diff --git a/src/plugin.c b/src/plugin.c
index 68eab659..0690629a 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -1,20 +1,17 @@
+#include "plugin.h"
+#include "log.h"
+
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
-#include "plugin.h"
-#include "log.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#ifdef HAVE_VALGRIND_VALGRIND_H
-#include <valgrind/valgrind.h>
+# include <valgrind/valgrind.h>
#endif
#ifndef __WIN32
-#include <dlfcn.h>
+# include <dlfcn.h>
#endif
/*
*
diff --git a/src/proc_open.c b/src/proc_open.c
index 7c7a560a..eb9dbdd9 100644
--- a/src/proc_open.c
+++ b/src/proc_open.c
@@ -1,15 +1,16 @@
+#include "proc_open.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
-#include "proc_open.h"
#ifdef WIN32
-#include <io.h>
-#include <fcntl.h>
+# include <io.h>
+# include <fcntl.h>
#else
-#include <sys/wait.h>
-#include <unistd.h>
+# include <sys/wait.h>
+# include <unistd.h>
#endif
diff --git a/src/request.c b/src/request.c
index 1b0037c2..2d080858 100644
--- a/src/request.c
+++ b/src/request.c
@@ -1,3 +1,7 @@
+#include "request.h"
+#include "keyvalue.h"
+#include "log.h"
+
#include <sys/stat.h>
#include <limits.h>
@@ -6,10 +10,6 @@
#include <stdio.h>
#include <ctype.h>
-#include "request.h"
-#include "keyvalue.h"
-#include "log.h"
-
static int request_check_hostname(server *srv, connection *con, buffer *host) {
enum { DOMAINLABEL, TOPLABEL } stage = TOPLABEL;
size_t i;
diff --git a/src/response.c b/src/response.c
index 34ba3de4..3213bc95 100644
--- a/src/response.c
+++ b/src/response.c
@@ -1,3 +1,14 @@
+#include "response.h"
+#include "keyvalue.h"
+#include "log.h"
+#include "stat_cache.h"
+#include "chunk.h"
+
+#include "configfile.h"
+#include "connections.h"
+
+#include "plugin.h"
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -13,17 +24,6 @@
#include <stdio.h>
-#include "response.h"
-#include "keyvalue.h"
-#include "log.h"
-#include "stat_cache.h"
-#include "chunk.h"
-
-#include "configfile.h"
-#include "connections.h"
-
-#include "plugin.h"
-
#include "sys-socket.h"
#include "version.h"
diff --git a/src/response.h b/src/response.h
index a479e0f0..289add89 100644
--- a/src/response.h
+++ b/src/response.h
@@ -1,10 +1,10 @@
#ifndef _RESPONSE_H_
#define _RESPONSE_H_
-#include <time.h>
-
#include "server.h"
+#include <time.h>
+
int http_response_parse(server *srv, connection *con);
int http_response_write_header(server *srv, connection *con);
diff --git a/src/server.c b/src/server.c
index 175e3178..32baff8e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1,19 +1,3 @@
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <time.h>
-#include <signal.h>
-#include <assert.h>
-#include <locale.h>
-
-#include <stdio.h>
-
#include "server.h"
#include "buffer.h"
#include "network.h"
@@ -31,29 +15,45 @@
#include "network_backends.h"
#include "version.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <time.h>
+#include <signal.h>
+#include <assert.h>
+#include <locale.h>
+
+#include <stdio.h>
+
#ifdef HAVE_GETOPT_H
-#include <getopt.h>
+# include <getopt.h>
#endif
#ifdef HAVE_VALGRIND_VALGRIND_H
-#include <valgrind/valgrind.h>
+# include <valgrind/valgrind.h>
#endif
#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
+# include <sys/wait.h>
#endif
#ifdef HAVE_PWD_H
-#include <grp.h>
-#include <pwd.h>
+# include <grp.h>
+# include <pwd.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
+# include <sys/resource.h>
#endif
#ifdef HAVE_SYS_PRCTL_H
-#include <sys/prctl.h>
+# include <sys/prctl.h>
#endif
#ifdef USE_OPENSSL
diff --git a/src/splaytree.c b/src/splaytree.c
index 0f8e68dc..51aa0ca7 100644
--- a/src/splaytree.c
+++ b/src/splaytree.c
@@ -46,9 +46,9 @@
Addison-Wesley, 1993, pp 367-375
*/
+#include "splaytree.h"
#include <stdlib.h>
#include <assert.h>
-#include "splaytree.h"
#define compare(i,j) ((i)-(j))
/* This is the comparison. */
diff --git a/src/stat_cache.c b/src/stat_cache.c
index 6b2a1daf..c1afade6 100644
--- a/src/stat_cache.c
+++ b/src/stat_cache.c
@@ -1,4 +1,7 @@
-#define _GNU_SOURCE
+#include "log.h"
+#include "stat_cache.h"
+#include "fdevent.h"
+#include "etag.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -11,13 +14,8 @@
#include <fcntl.h>
#include <assert.h>
-#include "log.h"
-#include "stat_cache.h"
-#include "fdevent.h"
-#include "etag.h"
-
#ifdef HAVE_ATTR_ATTRIBUTES_H
-#include <attr/attributes.h>
+# include <attr/attributes.h>
#endif
#ifdef HAVE_FAM_H
@@ -36,7 +34,7 @@
#endif
#ifndef HAVE_LSTAT
-#define lstat stat
+# define lstat stat
#endif
#if 0
diff --git a/src/status_counter.c b/src/status_counter.c
index eaf92515..ab130dad 100644
--- a/src/status_counter.c
+++ b/src/status_counter.c
@@ -1,6 +1,7 @@
+#include "status_counter.h"
+
#include <stdlib.h>
-#include "status_counter.h"
/**
* The status array can carry all the status information you want
* the key to the array is <module-prefix>.<name>
diff --git a/src/status_counter.h b/src/status_counter.h
index 210fe859..ba5e76f3 100644
--- a/src/status_counter.h
+++ b/src/status_counter.h
@@ -1,11 +1,11 @@
#ifndef _STATUS_COUNTER_H_
#define _STATUS_COUNTER_H_
-#include <sys/types.h>
-
#include "array.h"
#include "base.h"
+#include <sys/types.h>
+
data_integer *status_counter_get_counter(server *srv, const char *s, size_t len);
int status_counter_inc(server *srv, const char *s, size_t len);
int status_counter_dec(server *srv, const char *s, size_t len);
diff --git a/src/stream.c b/src/stream.c
index d2496473..f91e73c7 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1,14 +1,11 @@
+#include "stream.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
-#include "stream.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include "sys-mmap.h"
#ifndef O_BINARY
diff --git a/src/version.h b/src/version.h
index f8eea227..e05b6545 100644
--- a/src/version.h
+++ b/src/version.h
@@ -2,9 +2,9 @@
#define _VERSION_H_
#ifdef HAVE_VERSION_H
-#include "versionstamp.h"
+# include "versionstamp.h"
#else
-#define REPO_VERSION ""
+# define REPO_VERSION ""
#endif
#define PACKAGE_DESC PACKAGE_NAME "/" PACKAGE_VERSION REPO_VERSION