Browse Source

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)
Nick Mathewson 6 years ago
parent
commit
4438ef3288

+ 0 - 1
src/common/buffers.h

@@ -12,7 +12,6 @@
 #ifndef TOR_BUFFERS_H
 #define TOR_BUFFERS_H
 
-#include "compat.h"
 #include "compat.h"
 #include "torint.h"
 #include "testsupport.h"

+ 0 - 1
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__) || ... */
 

+ 0 - 1
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

+ 0 - 1
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);

+ 0 - 2
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"

+ 0 - 1
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"
 

+ 0 - 1
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"

+ 0 - 1
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"

+ 0 - 1
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);

+ 0 - 1
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"

+ 4 - 2
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"

+ 0 - 4
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"
 

+ 0 - 1
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"

+ 0 - 1
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)

+ 0 - 1
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"

+ 0 - 2
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"

+ 0 - 1
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"