From 2886768d30823a46b5f45b8c0ca6e64ee1e88f7a Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Sun, 20 May 2007 14:43:40 +0000 Subject: [PATCH] Clean up the #include sections in the btpd files. Most common headers and all btpd headers are included through btpd.h. --- btpd/active.c | 6 ------ btpd/btpd.c | 6 ++---- btpd/btpd.h | 30 ++++++++++++++++++++---------- btpd/cli_if.c | 18 +++--------------- btpd/content.c | 13 ++----------- btpd/download.c | 3 --- btpd/download_subr.c | 9 ++------- btpd/http_tr_if.c | 8 ++------ btpd/main.c | 14 ++------------ btpd/net.c | 19 ++----------------- btpd/net_buf.c | 3 --- btpd/opts.c | 3 +-- btpd/peer.c | 9 +-------- btpd/tlib.c | 11 +++-------- btpd/torrent.c | 16 +--------------- btpd/tracker_req.c | 4 ---- btpd/udp_tr_if.c | 9 +-------- btpd/upload.c | 2 -- btpd/util.c | 6 ++---- 19 files changed, 44 insertions(+), 145 deletions(-) diff --git a/btpd/active.c b/btpd/active.c index 9db9a04..567b7a5 100644 --- a/btpd/active.c +++ b/btpd/active.c @@ -1,9 +1,3 @@ -#include -#include - -#include -#include - #include "btpd.h" void diff --git a/btpd/btpd.c b/btpd/btpd.c index 965876b..67419ed 100644 --- a/btpd/btpd.c +++ b/btpd/btpd.c @@ -1,10 +1,8 @@ +#include "btpd.h" + #include -#include #include -#include "btpd.h" -#include "active.h" - static uint8_t m_peer_id[20]; static struct event m_sigint; static struct event m_sigterm; diff --git a/btpd/btpd.h b/btpd/btpd.h index 6651b49..848914c 100644 --- a/btpd/btpd.h +++ b/btpd/btpd.h @@ -2,23 +2,35 @@ #define BTPD_H #include -#include +#include #include +#include +#include +#include + #include #include -#include +#include +#include #include #include #include +#include #include +#include +#include -#include "queue.h" +#include +#define DAEMON +#include +#undef DAEMON +#include +#include +#include +#include -#include "benc.h" -#include "metainfo.h" -#include "subr.h" -#include "iobuf.h" +#include "active.h" #include "hashtable.h" #include "net_buf.h" #include "net_types.h" @@ -30,9 +42,7 @@ #include "upload.h" #include "content.h" #include "opts.h" -#define DAEMON -#include "btpd_if.h" -#undef DAEMON +#include "tracker_req.h" #define BTPD_VERSION PACKAGE_NAME "/" PACKAGE_VERSION diff --git a/btpd/cli_if.c b/btpd/cli_if.c index 20afbac..23f9f7a 100644 --- a/btpd/cli_if.c +++ b/btpd/cli_if.c @@ -1,19 +1,7 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - #include "btpd.h" -#include "active.h" -#include "tracker_req.h" + +#include +#include struct cli { int sd; diff --git a/btpd/content.c b/btpd/content.c index 5807477..d29e22c 100644 --- a/btpd/content.c +++ b/btpd/content.c @@ -1,16 +1,7 @@ -#include -#include - -#include -#include -#include -#include -#include +#include "btpd.h" #include - -#include "btpd.h" -#include "stream.h" +#include struct content { enum { CM_INACTIVE, CM_STARTING, CM_ACTIVE } state; diff --git a/btpd/download.c b/btpd/download.c index 523886a..d24b0a2 100644 --- a/btpd/download.c +++ b/btpd/download.c @@ -1,7 +1,4 @@ -#include - #include "btpd.h" -#include "tracker_req.h" /* * Called when a peer announces it's got a new piece. diff --git a/btpd/download_subr.c b/btpd/download_subr.c index d12efa9..2f57f07 100644 --- a/btpd/download_subr.c +++ b/btpd/download_subr.c @@ -19,15 +19,10 @@ * */ -#include -#include -#include -#include +#include "btpd.h" #include - -#include "btpd.h" -#include "stream.h" +#include static struct piece * piece_alloc(struct net *n, uint32_t index) diff --git a/btpd/http_tr_if.c b/btpd/http_tr_if.c index 78741ac..9247b5e 100644 --- a/btpd/http_tr_if.c +++ b/btpd/http_tr_if.c @@ -1,10 +1,6 @@ -#include -#include -#include - #include "btpd.h" -#include "tracker_req.h" -#include "http_client.h" + +#include #define MAX_DOWNLOAD (1 << 18) // 256kB diff --git a/btpd/main.c b/btpd/main.c index 79bbcd9..ea9df58 100644 --- a/btpd/main.c +++ b/btpd/main.c @@ -1,19 +1,9 @@ -#include -#include -#include -#include +#include "btpd.h" +#include #include -#include -#include #include -#include #include -#include -#include -#include - -#include "btpd.h" static void writepid(int pidfd) diff --git a/btpd/net.c b/btpd/net.c index b2a1032..5829dc3 100644 --- a/btpd/net.c +++ b/btpd/net.c @@ -1,23 +1,8 @@ -#include +#include "btpd.h" + #include -#include -#include #include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "btpd.h" - static unsigned long m_bw_bytes_in; static unsigned long m_bw_bytes_out; diff --git a/btpd/net_buf.c b/btpd/net_buf.c index 0be194c..1d9c3bf 100644 --- a/btpd/net_buf.c +++ b/btpd/net_buf.c @@ -1,6 +1,3 @@ -#include -#include - #include "btpd.h" static struct net_buf *m_choke; diff --git a/btpd/opts.c b/btpd/opts.c index 1893e2c..a46bf42 100644 --- a/btpd/opts.c +++ b/btpd/opts.c @@ -1,5 +1,4 @@ -#include -#include +#include "btpd.h" const char *btpd_dir; #ifdef DEBUG diff --git a/btpd/peer.c b/btpd/peer.c index f84d886..7af6c21 100644 --- a/btpd/peer.c +++ b/btpd/peer.c @@ -1,13 +1,6 @@ -#include -#include -#include +#include "btpd.h" #include -#include -#include -#include - -#include "btpd.h" void peer_kill(struct peer *p) diff --git a/btpd/tlib.c b/btpd/tlib.c index 3debe85..03c1381 100644 --- a/btpd/tlib.c +++ b/btpd/tlib.c @@ -1,13 +1,8 @@ -#include -#include -#include +#include "btpd.h" +#include #include -#include -#include -#include - -#include "btpd.h" +#include HTBL_TYPE(numtbl, tlib, unsigned, num, nchain); HTBL_TYPE(hashtbl, tlib, uint8_t, hash, hchain); diff --git a/btpd/torrent.c b/btpd/torrent.c index d99cd80..c77e9da 100644 --- a/btpd/torrent.c +++ b/btpd/torrent.c @@ -1,21 +1,7 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "btpd.h" #include -#include "btpd.h" -#include "tracker_req.h" -#include "stream.h" - #define SAVE_INTERVAL 300 static unsigned m_ntorrents; diff --git a/btpd/tracker_req.c b/btpd/tracker_req.c index 61425cb..f3acc1e 100644 --- a/btpd/tracker_req.c +++ b/btpd/tracker_req.c @@ -1,8 +1,4 @@ -#include - #include "btpd.h" -#include "subr.h" -#include "tracker_req.h" #define REQ_DELAY 1 #define STOP_ERRORS 5 diff --git a/btpd/udp_tr_if.c b/btpd/udp_tr_if.c index 6fcfa89..3790d95 100644 --- a/btpd/udp_tr_if.c +++ b/btpd/udp_tr_if.c @@ -1,13 +1,6 @@ -#include -#include -#include +#include "btpd.h" -#include #include -#include - -#include "btpd.h" -#include "tracker_req.h" struct udp_tr_req { enum { UDP_RESOLVE, UDP_CONN_SEND, UDP_CONN_RECV, diff --git a/btpd/upload.c b/btpd/upload.c index e2ea30b..cd8fabf 100644 --- a/btpd/upload.c +++ b/btpd/upload.c @@ -1,5 +1,3 @@ -#include - #include "btpd.h" #define CHOKE_INTERVAL (& (struct timeval) { 10, 0 }) diff --git a/btpd/util.c b/btpd/util.c index c4d4757..b2f2b3d 100644 --- a/btpd/util.c +++ b/btpd/util.c @@ -1,10 +1,8 @@ +#include "btpd.h" + #include -#include -#include #include -#include "btpd.h" - void * btpd_malloc(size_t size) {