]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove a bunch of other redundant #includes
authorNick Mathewson <nickm@torproject.org>
Tue, 20 Feb 2018 15:14:15 +0000 (10:14 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 20 Feb 2018 15:14:15 +0000 (10:14 -0500)
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)

17 files changed:
src/common/buffers.h
src/common/compat.c
src/common/compat_winthreads.c
src/or/circuituse.c
src/or/hs_client.c
src/or/hs_common.c
src/or/hs_intropoint.c
src/or/hs_service.c
src/or/rephist.c
src/or/status.c
src/test/test_address.c
src/test/test_config.c
src/test/test_dir_handle_get.c
src/test/test_helpers.c
src/test/test_hs_intropoint.c
src/test/testing_common.c
src/tools/tor-gencert.c

index 22a5f7bfa3b64829b3c6c81d7bc2000d32a14f85..4275152de2211900024e2fb55762407eeb02d09a 100644 (file)
@@ -12,7 +12,6 @@
 #ifndef TOR_BUFFERS_H
 #define TOR_BUFFERS_H
 
-#include "compat.h"
 #include "compat.h"
 #include "torint.h"
 #include "testsupport.h"
index 831813c1cc653c304e7b2bf6e6c0e551afaba525..e8916c8d1f2b11c12e37256588a7425ac0a2f1b9 100644 (file)
@@ -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__) || ... */
 
index 5f7ec94c23ff0bddc4668315baeabe13c6435ee0..7021344f6ea355f56b6177d34428bed441a26987 100644 (file)
@@ -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
index 13bd84e65c6572e44f0711572b7f38da5ca9a336..8d388cc2c6281d49050fe2980837822ce59ab031 100644 (file)
@@ -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);
index d3d13723e4a6a8b719d649ca84158ca75965954a..20963cd4531b86db4a4f039bbee3425fdbded930 100644 (file)
@@ -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"
index 6d97c8775c4fc5f8219ebfd319e2d675986ea128..aa34b0e8fb7a11b4192ee4be3a20c99dc9e0340d 100644 (file)
@@ -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"
 
index 8c6453e6fd1fd9ba73774541cd7de6ab17757695..3274e8e9c06d32064123ca0505d4ff5d6d0f1a97 100644 (file)
@@ -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"
index 8ae00df48edfa5b541ff57e4d753ef6e9a043dd4..220d3f5157696f6dc5f5366bd82d6072a267cf25 100644 (file)
@@ -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"
index 43494692cb596e2d7b82790130863630cc497026..ac3e9f502ed711956b3c2fda886958606ab540d6 100644 (file)
@@ -86,7 +86,6 @@
 #include "ht.h"
 #include "channelpadding.h"
 
-#include "channelpadding.h"
 #include "connection_or.h"
 
 static void bw_arrays_init(void);
index 4f7be164b183e1f2dac30f4d30dba0dd67be4d00..4c497739e80e0a2b42e6a1ffbb143c6bed3a5026 100644 (file)
@@ -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"
index 9c88d37a41b1158e678f68a4388b1dd3a87c086b..0dd7b403344731149912e36a646c6bd0a82bfa25 100644 (file)
 #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"
index d42335de3857bc62c0662876120c4a7d949e309b..3729c8aabb591e07832e1dd1e06210e6ca7989c2 100644 (file)
@@ -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"
 
index ca64dce5fef8c98dd88db6c0d3ef9cbd98fe835f..71faf70af241a9054ec13a5c1a94b9c9a6d9d13d 100644 (file)
@@ -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"
index 0da9cf64d008eb340aa46a95a6c78f1d0bcb6da2..ab453d3bdc3c003b6cf29b6ecb7ca81b4b31e81b 100644 (file)
@@ -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)
index 55dfafbeac91e2d9722efa45c113b125c0a99d2d..fe3236c331093654ab771fdd892140699cdde71f 100644 (file)
@@ -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"
index 52729147b2d1c7d9fd07e234fcc705a448863377..b9b36d96d05b354aa8dd220a58bb8d044671369d 100644 (file)
@@ -29,8 +29,6 @@
 #include <dirent.h>
 #endif /* defined(_WIN32) */
 
-#include "or.h"
-
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
 #include "main.h"
index fb7465c0eb8df741a15ce6ed5a13acf214a488d6..0e7fc79e6f6294abae22cc7545067634b40de03d 100644 (file)
@@ -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"