commit 443a77087d139943af827688fdb0262f4df82959 Author: Zack Weinberg zackw@panix.com Date: Mon Jul 18 14:51:54 2011 -0700
All .c files include util.h first. No .h file includes util.h. util.h includes config.h. tinytest_macros.h includes tinytest.h, stdio.h, stdlib.h, string.h. --- src/crypt.c | 3 ++- src/main.c | 1 + src/network.c | 3 ++- src/network.h | 2 -- src/protocol.c | 3 ++- src/protocols/dummy.c | 3 ++- src/protocols/obfs2.c | 4 ++-- src/sha256.c | 3 ++- src/socks.c | 4 ++-- src/test/tinytest_macros.h | 5 +++++ src/test/unittest_crypt.c | 5 +---- src/test/unittest_obfs2.c | 7 +------ src/test/unittest_socks.c | 7 +------ src/util.h | 1 + 14 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/src/crypt.c b/src/crypt.c index 9984e24..e28e061 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -2,9 +2,10 @@ See LICENSE for other credits and copying information */
+#include "util.h" + #define CRYPT_PRIVATE #include "crypt.h" -#include "util.h"
#include <fcntl.h> #include <limits.h> diff --git a/src/main.c b/src/main.c index c48f81a..a7aa298 100644 --- a/src/main.c +++ b/src/main.c @@ -3,6 +3,7 @@ */
#include "util.h" + #include "network.h" #include "protocol.h"
diff --git a/src/network.c b/src/network.c index fcbb45c..35e4eaf 100644 --- a/src/network.c +++ b/src/network.c @@ -2,10 +2,11 @@ See LICENSE for other credits and copying information */
+#include "util.h" + #define NETWORK_PRIVATE #include "network.h"
-#include "util.h" #include "main.h" #include "socks.h" #include "protocol.h" diff --git a/src/network.h b/src/network.h index ad54686..e631697 100644 --- a/src/network.h +++ b/src/network.h @@ -39,8 +39,6 @@ void start_shutdown(int barbaric);
#ifdef NETWORK_PRIVATE
-#include "util.h" - struct bufferevent; struct socks_state_t; struct protocol_t; diff --git a/src/protocol.c b/src/protocol.c index 4473a94..6abf7f1 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -2,10 +2,11 @@ See LICENSE for other credits and copying information */
+#include "util.h" + #include "protocol.h" #include "protocols/obfs2.h" #include "protocols/dummy.h" -#include "util.h"
#include <stdlib.h> #include <string.h> diff --git a/src/protocols/dummy.c b/src/protocols/dummy.c index b1493ce..c65f7b5 100644 --- a/src/protocols/dummy.c +++ b/src/protocols/dummy.c @@ -2,9 +2,10 @@ See LICENSE for other credits and copying information */
+#include "../util.h" + #include "dummy.h" #include "../protocol.h" -#include "../util.h"
#include <stdlib.h> #include <string.h> diff --git a/src/protocols/obfs2.c b/src/protocols/obfs2.c index 5acd09e..f17af90 100644 --- a/src/protocols/obfs2.c +++ b/src/protocols/obfs2.c @@ -2,11 +2,11 @@ See LICENSE for other credits and copying information */
+#include "../util.h" + #define PROTOCOL_OBFS2_PRIVATE #include "obfs2.h"
-#include "../util.h" - #include <stdlib.h> #include <string.h>
diff --git a/src/sha256.c b/src/sha256.c index d303f5f..7d273ae 100644 --- a/src/sha256.c +++ b/src/sha256.c @@ -4,8 +4,9 @@ LibTomCrypt, version 1.6. Tor uses it on platforms where OpenSSL doesn't have a SHA256. */
-#include "sha256.h" #include "util.h" + +#include "sha256.h" #include <string.h> #include <arpa/inet.h> /* for htonl/ntohl */
diff --git a/src/socks.c b/src/socks.c index 6bd708f..333c787 100644 --- a/src/socks.c +++ b/src/socks.c @@ -2,11 +2,11 @@ See LICENSE for other credits and copying information */
+#include "util.h" + #define SOCKS_PRIVATE #include "socks.h"
-#include "util.h" - #include <errno.h> #include <stdlib.h> #include <string.h> diff --git a/src/test/tinytest_macros.h b/src/test/tinytest_macros.h index 089616a..25ee7e2 100644 --- a/src/test/tinytest_macros.h +++ b/src/test/tinytest_macros.h @@ -26,6 +26,11 @@ #ifndef _TINYTEST_MACROS_H #define _TINYTEST_MACROS_H
+#include "tinytest.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + /* Helpers for defining statement-like macros */ #define TT_STMT_BEGIN do { #define TT_STMT_END } while(0) diff --git a/src/test/unittest_crypt.c b/src/test/unittest_crypt.c index 5a3e2aa..a3574f6 100644 --- a/src/test/unittest_crypt.c +++ b/src/test/unittest_crypt.c @@ -2,15 +2,12 @@ See LICENSE for other credits and copying information */
-#include "tinytest.h" +#include "../util.h" #include "tinytest_macros.h"
#define CRYPT_PRIVATE #include "../crypt.h"
-#include <stdio.h> -#include <string.h> - /* Test vectors for sha256 */ static void test_crypt_hashvec(void *data) diff --git a/src/test/unittest_obfs2.c b/src/test/unittest_obfs2.c index 3ac4c42..099acd2 100644 --- a/src/test/unittest_obfs2.c +++ b/src/test/unittest_obfs2.c @@ -2,18 +2,13 @@ See LICENSE for other credits and copying information */
-#include "tinytest.h" +#include "../util.h" #include "tinytest_macros.h"
#define PROTOCOL_OBFS2_PRIVATE #define CRYPT_PRIVATE #include "../protocols/obfs2.h" #include "../crypt.h" -#include "../util.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h>
#include <event2/buffer.h>
diff --git a/src/test/unittest_socks.c b/src/test/unittest_socks.c index db4f120..9ba9e7e 100644 --- a/src/test/unittest_socks.c +++ b/src/test/unittest_socks.c @@ -2,17 +2,12 @@ See LICENSE for other credits and copying information */
-#include "tinytest.h" +#include "../util.h" #include "tinytest_macros.h"
#define SOCKS_PRIVATE #include "../socks.h" #include "../crypt.h" -#include "../util.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h>
#include <event2/buffer.h>
diff --git a/src/util.h b/src/util.h index 8e5dd77..d365cbc 100644 --- a/src/util.h +++ b/src/util.h @@ -5,6 +5,7 @@ #ifndef UTIL_H #define UTIL_H
+#include "config.h" #include <stdarg.h> /* for va_list */ #include <stddef.h> /* size_t, offsetof, NULL, etc */
tor-commits@lists.torproject.org