[master] f971cdf Even more #include cleanup

Poul-Henning Kamp phk at varnish-cache.org
Sat Oct 8 23:58:10 CEST 2011


commit f971cdfa6ce63ab7b4fbd2c1191f6b044dd2f488
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Oct 8 21:58:01 2011 +0000

    Even more #include cleanup

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index c9b3ac2..d3228a5 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -34,8 +34,6 @@
  */
 #define VARNISH_CACHE_CHILD	1
 
-#include <sys/time.h>
-#include <sys/uio.h>
 #include <sys/socket.h>
 
 #include <pthread.h>
@@ -52,15 +50,9 @@
 #include <sys/epoll.h>
 #endif
 
-#include "vqueue.h"
-
-#include "vsb.h"
-
-#include "libvarnish.h"
-
 #include "common.h"
+
 #include "heritage.h"
-#include "miniobj.h"
 
 #include "vsc.h"
 #include "vsl.h"
@@ -99,6 +91,7 @@ enum {
 	HTTP_HDR_FIRST,
 };
 
+struct iovec;
 struct cli;
 struct vsb;
 struct sess;
diff --git a/bin/varnishd/cache_backend.c b/bin/varnishd/cache_backend.c
index 1061612..a724923 100644
--- a/bin/varnishd/cache_backend.c
+++ b/bin/varnishd/cache_backend.c
@@ -32,16 +32,11 @@
 
 #include "config.h"
 
-#include <limits.h>
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 #include <poll.h>
 
-#include <sys/socket.h>
-
 #include "cache.h"
+
 #include "cache_backend.h"
 #include "vrt.h"
 
diff --git a/bin/varnishd/cache_ban.c b/bin/varnishd/cache_ban.c
index 09e68cc..f346b4d 100644
--- a/bin/varnishd/cache_ban.c
+++ b/bin/varnishd/cache_ban.c
@@ -63,7 +63,6 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <stdint.h>
 
 #include <pcre.h>
 
diff --git a/bin/varnishd/cache_dir_dns.c b/bin/varnishd/cache_dir_dns.c
index d3635a9..3fd2aa1 100644
--- a/bin/varnishd/cache_dir_dns.c
+++ b/bin/varnishd/cache_dir_dns.c
@@ -29,14 +29,9 @@
 
 #include "config.h"
 
-#include <sys/types.h>
-#include <sys/socket.h>
-
 #include <errno.h>
 #include <stdlib.h>
-#include <string.h>
 #include <netdb.h>
-#include <unistd.h>
 
 #include <stdio.h>
 #include <netinet/in.h>
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index 7c6e2e5..df56c7a 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -31,7 +31,6 @@
 
 #include <stdio.h>
 #include <inttypes.h>
-#include <string.h>
 #include <stdlib.h>
 #include <fcntl.h>
 
diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index 3703b00..dd55990 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -31,9 +31,7 @@
 
 #include "config.h"
 
-#include <stdarg.h>
 #include <stdio.h>
-#include <string.h>
 
 #include "cache.h"
 
diff --git a/bin/varnishd/cache_httpconn.c b/bin/varnishd/cache_httpconn.c
index d1ceb6e..ba881c9 100644
--- a/bin/varnishd/cache_httpconn.c
+++ b/bin/varnishd/cache_httpconn.c
@@ -31,9 +31,6 @@
 
 #include "config.h"
 
-#include <stdlib.h>
-#include <string.h>
-
 #include "cache.h"
 
 #include "vct.h"
diff --git a/bin/varnishd/cache_lck.c b/bin/varnishd/cache_lck.c
index 18d1b41..ee93b9f 100644
--- a/bin/varnishd/cache_lck.c
+++ b/bin/varnishd/cache_lck.c
@@ -35,8 +35,6 @@
 
 #include "config.h"
 
-#include <stdio.h>
-
 #include <stdlib.h>
 
 #include "cache.h"
diff --git a/bin/varnishd/cache_main.c b/bin/varnishd/cache_main.c
index 5660893..b4ee185 100644
--- a/bin/varnishd/cache_main.c
+++ b/bin/varnishd/cache_main.c
@@ -30,11 +30,10 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <unistd.h>
 #include <stdlib.h>
-#include <signal.h>
 
 #include "cache.h"
+
 #include "stevedore.h"
 #include "hash_slinger.h"
 #include "cache_waiter.h"
diff --git a/bin/varnishd/cache_panic.c b/bin/varnishd/cache_panic.c
index a9c5c15..464924a 100644
--- a/bin/varnishd/cache_panic.c
+++ b/bin/varnishd/cache_panic.c
@@ -29,19 +29,17 @@
 
 #include "config.h"
 
-#include <signal.h>
-#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
-#include <pthread.h>
 
 #ifndef HAVE_EXECINFO_H
 #include "compat/execinfo.h"
 #else
 #include <execinfo.h>
 #endif
+
 #include "cache.h"
+
 #include "vsm.h"
 #include "cache_backend.h"
 #include "cache_waiter.h"
diff --git a/bin/varnishd/cache_shmlog.c b/bin/varnishd/cache_shmlog.c
index 023c20a..8c06897 100644
--- a/bin/varnishd/cache_shmlog.c
+++ b/bin/varnishd/cache_shmlog.c
@@ -30,8 +30,6 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <unistd.h>
-#include <stdarg.h>
 
 #include "cache.h"
 #include "vmb.h"
diff --git a/bin/varnishd/cache_vary.c b/bin/varnishd/cache_vary.c
index b7a6b01..4440d55 100644
--- a/bin/varnishd/cache_vary.c
+++ b/bin/varnishd/cache_vary.c
@@ -54,10 +54,8 @@
 
 #include "config.h"
 
-#include <string.h>
-#include <stdlib.h>
-
 #include "cache.h"
+
 #include "vend.h"
 #include "vct.h"
 
diff --git a/bin/varnishd/cache_vcl.c b/bin/varnishd/cache_vcl.c
index 8848ddd..99364b5 100644
--- a/bin/varnishd/cache_vcl.c
+++ b/bin/varnishd/cache_vcl.c
@@ -34,15 +34,13 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <unistd.h>
-#include <string.h>
 #include <stdlib.h>
 #include <dlfcn.h>
 
+#include "cache.h"
 #include "vcli.h"
 #include "cli_priv.h"
 #include "vcl.h"
-#include "cache.h"
 #include "libvcl.h"
 
 struct vcls {
diff --git a/bin/varnishd/cache_vrt.c b/bin/varnishd/cache_vrt.c
index 02d2a42..f0407cc 100644
--- a/bin/varnishd/cache_vrt.c
+++ b/bin/varnishd/cache_vrt.c
@@ -35,9 +35,7 @@
 #include <arpa/inet.h>
 
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
-#include <stdarg.h>
 
 #include "cache.h"
 
diff --git a/bin/varnishd/cache_vrt_var.c b/bin/varnishd/cache_vrt_var.c
index e26b433..ae65058 100644
--- a/bin/varnishd/cache_vrt_var.c
+++ b/bin/varnishd/cache_vrt_var.c
@@ -31,12 +31,12 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <stdarg.h>
 #include <stdlib.h>
 
+#include "cache.h"
+
 #include "vrt.h"
 #include "vrt_obj.h"
-#include "cache.h"
 #include "cache_backend.h"
 #include "hash_slinger.h"
 
diff --git a/bin/varnishd/cache_waiter_epoll.c b/bin/varnishd/cache_waiter_epoll.c
index 28776cd..d4168db 100644
--- a/bin/varnishd/cache_waiter_epoll.c
+++ b/bin/varnishd/cache_waiter_epoll.c
@@ -35,22 +35,18 @@
 
 #if defined(HAVE_EPOLL_CTL)
 
-#include <stdio.h>
-#include <string.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
-#include <unistd.h>
-
 #include <sys/epoll.h>
 
+#include "cache.h"
+#include "cache_waiter.h"
+
 #ifndef EPOLLRDHUP
 #  define EPOLLRDHUP 0
 #endif
 
-#include "cache.h"
-#include "cache_waiter.h"
-
 #define NEEV	100
 
 struct vwe {
diff --git a/bin/varnishd/cache_waiter_kqueue.c b/bin/varnishd/cache_waiter_kqueue.c
index 9575dc8..f023c3f 100644
--- a/bin/varnishd/cache_waiter_kqueue.c
+++ b/bin/varnishd/cache_waiter_kqueue.c
@@ -35,13 +35,10 @@
 
 #if defined(HAVE_KQUEUE)
 
-#include <stdio.h>
-#include <string.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
-
 #include <sys/event.h>
 
 #include "cache.h"
diff --git a/bin/varnishd/cache_waiter_ports.c b/bin/varnishd/cache_waiter_ports.c
index 695e9c0..04c6e92 100644
--- a/bin/varnishd/cache_waiter_ports.c
+++ b/bin/varnishd/cache_waiter_ports.c
@@ -35,9 +35,7 @@
 
 #include <stdio.h>
 #include <errno.h>
-#include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <math.h>
 
 #include <port.h>
diff --git a/bin/varnishd/cache_wrw.c b/bin/varnishd/cache_wrw.c
index 61aa2e5..5f9c29b 100644
--- a/bin/varnishd/cache_wrw.c
+++ b/bin/varnishd/cache_wrw.c
@@ -40,13 +40,13 @@
 
 #ifdef SENDFILE_WORKS
 #if defined(__FreeBSD__) || defined(__DragonFly__)
-#include <sys/socket.h>
+   // We're fine
 #elif defined(__linux__)
-#include <sys/sendfile.h>
+#  include <sys/sendfile.h>
 #elif defined(__sun)
-#include <sys/sendfile.h>
+#  include <sys/sendfile.h>
 #else
-#error Unknown sendfile() implementation
+#  error Unknown sendfile() implementation
 #endif
 #endif /* SENDFILE_WORKS */
 
diff --git a/bin/varnishd/common.h b/bin/varnishd/common.h
index 3708b45..f755b97 100644
--- a/bin/varnishd/common.h
+++ b/bin/varnishd/common.h
@@ -28,6 +28,11 @@
  *
  */
 
+#include "libvarnish.h"
+#include "vsb.h"
+#include "vqueue.h"
+#include "miniobj.h"
+
 struct cli;
 
 extern pid_t mgt_pid;
diff --git a/bin/varnishd/mgt.h b/bin/varnishd/mgt.h
index 8958ab5..9d12752 100644
--- a/bin/varnishd/mgt.h
+++ b/bin/varnishd/mgt.h
@@ -30,13 +30,7 @@
 
 #include <stdint.h>
 
-#include "vqueue.h"
-
 #include "common.h"
-#include "vsb.h"
-#include "miniobj.h"
-
-#include "libvarnish.h"
 
 struct cli;
 
diff --git a/bin/varnishd/mgt_pool.c b/bin/varnishd/mgt_pool.c
index 1238f5e..4b3fe92 100644
--- a/bin/varnishd/mgt_pool.c
+++ b/bin/varnishd/mgt_pool.c
@@ -46,9 +46,7 @@
 #include <string.h>
 #include <limits.h>
 #include <unistd.h>
-#include <sys/types.h>
 
-#include "cli_priv.h"
 #include "mgt.h"
 
 #include "vparam.h"
diff --git a/bin/varnishd/mgt_sandbox_solaris.c b/bin/varnishd/mgt_sandbox_solaris.c
index 15b7c95..2c975d9 100644
--- a/bin/varnishd/mgt_sandbox_solaris.c
+++ b/bin/varnishd/mgt_sandbox_solaris.c
@@ -36,8 +36,6 @@
 
 #include <stdio.h>
 #include <syslog.h>
-#include <unistd.h>
-#include <string.h>
 
 #ifdef HAVE_PRIV_H
 #include <priv.h>
diff --git a/bin/varnishd/mgt_vcc.c b/bin/varnishd/mgt_vcc.c
index 6c100bb..f8e81ca 100644
--- a/bin/varnishd/mgt_vcc.c
+++ b/bin/varnishd/mgt_vcc.c
@@ -31,9 +31,6 @@
 
 #include "config.h"
 
-#include <sys/types.h>
-#include <sys/wait.h>
-
 #include <dlfcn.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -45,13 +42,9 @@
 
 #include "libvcl.h"
 #include "vcli.h"
+#include "vcl.h"
 #include "cli_priv.h"
-#include "cli_common.h"
-
 #include "mgt_cli.h"
-#include "heritage.h"
-
-#include "vcl.h"
 
 struct vclprog {
 	VTAILQ_ENTRY(vclprog)	list;
diff --git a/bin/varnishd/stevedore_utils.c b/bin/varnishd/stevedore_utils.c
index 1dcfd63..af7fc7f 100644
--- a/bin/varnishd/stevedore_utils.c
+++ b/bin/varnishd/stevedore_utils.c
@@ -33,7 +33,6 @@
 
 #include <fcntl.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/bin/varnishd/storage_persistent.h b/bin/varnishd/storage_persistent.h
index 2a5bd77..84f3d21 100644
--- a/bin/varnishd/storage_persistent.h
+++ b/bin/varnishd/storage_persistent.h
@@ -33,14 +33,6 @@
  * XXX: Do we ever free the LRU-lists ?
  */
 
-#ifndef MAP_NOCORE
-#define MAP_NOCORE 0 /* XXX Linux */
-#endif
-
-#ifndef MAP_NOSYNC
-#define MAP_NOSYNC 0 /* XXX Linux */
-#endif
-
 #define ASSERT_SILO_THREAD(sc) \
     do {assert(pthread_self() == (sc)->thread);} while (0)
 
diff --git a/bin/varnishd/storage_persistent_mgt.c b/bin/varnishd/storage_persistent_mgt.c
index 3bd5809..c91fb43 100644
--- a/bin/varnishd/storage_persistent_mgt.c
+++ b/bin/varnishd/storage_persistent_mgt.c
@@ -47,6 +47,14 @@
 #include "persistent.h"
 #include "storage_persistent.h"
 
+#ifndef MAP_NOCORE
+#define MAP_NOCORE 0 /* XXX Linux */
+#endif
+
+#ifndef MAP_NOSYNC
+#define MAP_NOSYNC 0 /* XXX Linux */
+#endif
+
 /*--------------------------------------------------------------------
  * Calculate cleaner metrics from silo dimensions
  */
diff --git a/bin/varnishd/vsm.c b/bin/varnishd/vsm.c
index 62047ff..28f98e5 100644
--- a/bin/varnishd/vsm.c
+++ b/bin/varnishd/vsm.c
@@ -51,8 +51,6 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "miniobj.h"
-#include "libvarnish.h"
 #include "common.h"
 #include "vsm.h"
 #include "vmb.h"



More information about the varnish-commit mailing list