[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove a bunch of other redundant #includes



commit 4438ef3288256e1f1ba706c157206a2ac190781d
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Feb 20 10:14:15 2018 -0500

    Remove a bunch of other redundant #includes
    
    Folks have found two in the past week or so; we may as well fix the
    others.
    
    Found with:
    
    \#!/usr/bin/python3
    import re
    
    def findMulti(fname):
        includes = set()
        with open(fname) as f:
            for line in f:
                m = re.match(r'^\s*#\s*include\s+["<](\S+)[>"]', line)
                if m:
                    inc = m.group(1)
                    if inc in includes:
                        print("{}: {}".format(fname, inc))
                    includes.add(m.group(1))
    
    import sys
    for fname in sys.argv[1:]:
        findMulti(fname)
---
 src/common/buffers.h           | 1 -
 src/common/compat.c            | 1 -
 src/common/compat_winthreads.c | 1 -
 src/or/circuituse.c            | 1 -
 src/or/hs_client.c             | 2 --
 src/or/hs_common.c             | 1 -
 src/or/hs_intropoint.c         | 1 -
 src/or/hs_service.c            | 1 -
 src/or/rephist.c               | 1 -
 src/or/status.c                | 1 -
 src/test/test_address.c        | 6 ++++--
 src/test/test_config.c         | 4 ----
 src/test/test_dir_handle_get.c | 1 -
 src/test/test_helpers.c        | 1 -
 src/test/test_hs_intropoint.c  | 1 -
 src/test/testing_common.c      | 2 --
 src/tools/tor-gencert.c        | 1 -
 17 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/src/common/buffers.h b/src/common/buffers.h
index 22a5f7bfa..4275152de 100644
--- a/src/common/buffers.h
+++ b/src/common/buffers.h
@@ -13,7 +13,6 @@
 #define TOR_BUFFERS_H
 
 #include "compat.h"
-#include "compat.h"
 #include "torint.h"
 #include "testsupport.h"
 
diff --git a/src/common/compat.c b/src/common/compat.c
index 831813c1c..e8916c8d1 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -100,7 +100,6 @@ SecureZeroMemory(PVOID ptr, SIZE_T cnt)
 /* Only use the linux prctl;  the IRIX prctl is totally different */
 #include <sys/prctl.h>
 #elif defined(__APPLE__)
-#include <sys/types.h>
 #include <sys/ptrace.h>
 #endif /* defined(HAVE_SYS_PRCTL_H) && defined(__linux__) || ... */
 
diff --git a/src/common/compat_winthreads.c b/src/common/compat_winthreads.c
index 5f7ec94c2..7021344f6 100644
--- a/src/common/compat_winthreads.c
+++ b/src/common/compat_winthreads.c
@@ -18,7 +18,6 @@
 #include "util.h"
 #include "container.h"
 #include "torlog.h"
-#include <process.h>
 
 /* This value is more or less total cargo-cult */
 #define SPIN_COUNT 2000
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 13bd84e65..8d388cc2c 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -55,7 +55,6 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
-#include "config.h"
 
 static void circuit_expire_old_circuits_clientside(void);
 static void circuit_increment_failure_count(void);
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index d3d13723e..20963cd45 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -17,7 +17,6 @@
 #include "hs_descriptor.h"
 #include "hs_cache.h"
 #include "hs_cell.h"
-#include "hs_ident.h"
 #include "config.h"
 #include "directory.h"
 #include "hs_client.h"
@@ -29,7 +28,6 @@
 #include "connection.h"
 #include "nodelist.h"
 #include "circpathbias.h"
-#include "connection.h"
 #include "hs_ntor.h"
 #include "circuitbuild.h"
 #include "networkstatus.h"
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index 6d97c8775..aa34b0e8f 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -28,7 +28,6 @@
 #include "rendservice.h"
 #include "routerset.h"
 #include "router.h"
-#include "routerset.h"
 #include "shared_random.h"
 #include "shared_random_state.h"
 
diff --git a/src/or/hs_intropoint.c b/src/or/hs_intropoint.c
index 8c6453e6f..3274e8e9c 100644
--- a/src/or/hs_intropoint.c
+++ b/src/or/hs_intropoint.c
@@ -12,7 +12,6 @@
 #include "config.h"
 #include "circuitlist.h"
 #include "circuituse.h"
-#include "config.h"
 #include "relay.h"
 #include "rendmid.h"
 #include "rephist.h"
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 8ae00df48..220d3f515 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -31,7 +31,6 @@
 #include "hs_common.h"
 #include "hs_config.h"
 #include "hs_control.h"
-#include "hs_circuit.h"
 #include "hs_descriptor.h"
 #include "hs_ident.h"
 #include "hs_intropoint.h"
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 43494692c..ac3e9f502 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -86,7 +86,6 @@
 #include "ht.h"
 #include "channelpadding.h"
 
-#include "channelpadding.h"
 #include "connection_or.h"
 
 static void bw_arrays_init(void);
diff --git a/src/or/status.c b/src/or/status.c
index 4f7be164b..4c497739e 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -25,7 +25,6 @@
 #include "main.h"
 #include "rephist.h"
 #include "hibernate.h"
-#include "rephist.h"
 #include "statefile.h"
 #include "hs_stats.h"
 #include "hs_service.h"
diff --git a/src/test/test_address.c b/src/test/test_address.c
index 9c88d37a4..0dd7b4033 100644
--- a/src/test/test_address.c
+++ b/src/test/test_address.c
@@ -11,8 +11,11 @@
 #include <iphlpapi.h>
 #endif
 
-#ifdef HAVE_IFADDRS_TO_SMARTLIST
+#ifdef HAVE_NET_IF_H
 #include <net/if.h>
+#endif
+
+#ifdef HAVE_IFADDRS_TO_SMARTLIST
 #include <ifaddrs.h>
 #endif
 
@@ -20,7 +23,6 @@
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
-#include <net/if.h>
 #endif /* defined(HAVE_IFCONF_TO_SMARTLIST) */
 
 #include "or.h"
diff --git a/src/test/test_config.c b/src/test/test_config.c
index d42335de3..3729c8aab 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -20,7 +20,6 @@
 #include "connection_edge.h"
 #include "test.h"
 #include "util.h"
-#include "address.h"
 #include "connection_or.h"
 #include "control.h"
 #include "cpuworker.h"
@@ -42,9 +41,6 @@
 #include "routerlist.h"
 #include "routerset.h"
 #include "statefile.h"
-#include "test.h"
-#include "transports.h"
-#include "util.h"
 
 #include "test_helpers.h"
 
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index ca64dce5f..71faf70af 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -16,7 +16,6 @@
 #include "directory.h"
 #include "test.h"
 #include "compress.h"
-#include "connection.h"
 #include "rendcommon.h"
 #include "rendcache.h"
 #include "router.h"
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index 0da9cf64d..ab453d3bd 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -33,7 +33,6 @@ DISABLE_GCC_WARNING(overlength-strings)
  * at large. */
 #endif
 #include "test_descriptors.inc"
-#include "or.h"
 #include "circuitlist.h"
 #ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
 ENABLE_GCC_WARNING(overlength-strings)
diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c
index 55dfafbea..fe3236c33 100644
--- a/src/test/test_hs_intropoint.c
+++ b/src/test/test_hs_intropoint.c
@@ -14,7 +14,6 @@
 #include "test.h"
 #include "log_test_helpers.h"
 #include "crypto.h"
-#include "log_test_helpers.h"
 
 #include "or.h"
 #include "circuitlist.h"
diff --git a/src/test/testing_common.c b/src/test/testing_common.c
index 52729147b..b9b36d96d 100644
--- a/src/test/testing_common.c
+++ b/src/test/testing_common.c
@@ -29,8 +29,6 @@
 #include <dirent.h>
 #endif /* defined(_WIN32) */
 
-#include "or.h"
-
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
 #include "main.h"
diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c
index fb7465c0e..0e7fc79e6 100644
--- a/src/tools/tor-gencert.c
+++ b/src/tools/tor-gencert.c
@@ -36,7 +36,6 @@ ENABLE_GCC_WARNING(redundant-decls)
 #include <assert.h>
 #endif
 
-#include "compat.h"
 #include "util.h"
 #include "torlog.h"
 #include "crypto.h"

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits