[tor-commits] [tor/master] Remove other needless includes include from or/*.h

nickm at torproject.org nickm at torproject.org
Tue Jul 3 15:11:29 UTC 2018


commit 500826479aaf7d398f576fabbfdf34b17604f646
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sun Jul 1 12:06:52 2018 -0400

    Remove other needless includes include from or/*.h
---
 src/or/channel.c               |  2 +-
 src/or/channel.h               |  7 +++++--
 src/or/channelpadding.c        |  2 +-
 src/or/circuitlist.c           |  1 +
 src/or/connection.h            |  6 ++----
 src/or/hs_circuit.c            |  1 +
 src/or/hs_descriptor.c         |  2 +-
 src/or/hs_descriptor.h         |  4 ----
 src/or/main.c                  |  1 +
 src/or/onion_ntor.c            |  2 +-
 src/or/onion_ntor.h            |  6 +++---
 src/or/parsecommon.c           |  2 ++
 src/or/parsecommon.h           | 11 ++++++-----
 src/or/rendservice.c           |  1 +
 src/or/rendservice.h           |  5 ++---
 src/test/test_channelpadding.c |  2 ++
 src/test/test_routerlist.c     |  1 +
 17 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/src/or/channel.c b/src/or/channel.c
index ac1960ae0..981f9aecf 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -79,6 +79,7 @@
 #include "lib/time/compat_time.h"
 #include "or/networkstatus.h"
 #include "or/rendservice.h"
+#include "common/timers.h"
 
 #include "or/cell_queue_st.h"
 
@@ -3477,4 +3478,3 @@ channel_update_bad_for_new_circs(const char *digest, int force)
     channel_rsa_id_group_set_badness(&(*iter)->channel_list, force);
   }
 }
-
diff --git a/src/or/channel.h b/src/or/channel.h
index 6a7b0e7b8..cbcc13cc5 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -11,11 +11,13 @@
 
 #include "or/or.h"
 #include "or/circuitmux.h"
-#include "common/timers.h"
 #include "common/handles.h"
 
 #include "tor_queue.h"
 
+#define tor_timer_t timeout
+struct tor_timer_t;
+
 /* Channel handler function pointer typedefs */
 typedef void (*channel_listener_fn_ptr)(channel_listener_t *, channel_t *);
 typedef void (*channel_cell_handler_fn_ptr)(channel_t *, cell_t *);
@@ -94,7 +96,7 @@ struct channel_s {
   monotime_coarse_t next_padding_time;
 
   /** The callback pointer for the padding callbacks */
-  tor_timer_t *padding_timer;
+  struct tor_timer_t *padding_timer;
   /** The handle to this channel (to free on canceled timers) */
   struct channel_handle_t *timer_handle;
 
@@ -637,5 +639,6 @@ int packed_cell_is_destroy(channel_t *chan,
 HANDLE_DECL(channel, channel_s,)
 #define channel_handle_free(h)    \
   FREE_AND_NULL(channel_handle_t, channel_handle_free_, (h))
+#undef tor_timer_t
 
 #endif /* !defined(TOR_CHANNEL_H) */
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 6bef4d8b3..fa957c6c6 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -22,6 +22,7 @@
 #include "or/router.h"
 #include "lib/time/compat_time.h"
 #include "or/rendservice.h"
+#include "common/timers.h"
 
 #include "or/cell_st.h"
 #include "or/or_connection_st.h"
@@ -797,4 +798,3 @@ channelpadding_decide_to_pad_channel(channel_t *chan)
     return CHANNELPADDING_PADLATER;
   }
 }
-
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 441855271..f0a7446c9 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -91,6 +91,7 @@
 #include "lib/compress/compress_lzma.h"
 #include "lib/compress/compress_zlib.h"
 #include "lib/compress/compress_zstd.h"
+#include "lib/container/buffers.h"
 
 #include "ht.h"
 
diff --git a/src/or/connection.h b/src/or/connection.h
index 1bbe17bff..75198ed06 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -14,8 +14,7 @@
 
 listener_connection_t *TO_LISTENER_CONN(connection_t *);
 
-/* XXXX For buf_datalen in inline function */
-#include "lib/container/buffers.h"
+struct buf_t;
 
 const char *conn_type_to_string(int type);
 const char *conn_state_to_string(int type, int state);
@@ -159,7 +158,7 @@ connection_buf_add(const char *string, size_t len, connection_t *conn)
 }
 void connection_buf_add_compress(const char *string, size_t len,
                                  dir_connection_t *conn, int done);
-void connection_buf_add_buf(connection_t *conn, buf_t *buf);
+void connection_buf_add_buf(connection_t *conn, struct buf_t *buf);
 
 size_t connection_get_inbuf_len(connection_t *conn);
 size_t connection_get_outbuf_len(connection_t *conn);
@@ -259,4 +258,3 @@ MOCK_DECL(STATIC smartlist_t *, pick_oos_victims, (int n));
 #endif /* defined(CONNECTION_PRIVATE) */
 
 #endif /* !defined(TOR_CONNECTION_H) */
-
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 044ff2bbc..5a2c7e4e4 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -13,6 +13,7 @@
 #include "or/circuitlist.h"
 #include "or/circuituse.h"
 #include "or/config.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/nodelist.h"
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 8971ec59f..f436c6615 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -66,6 +66,7 @@
 #include "or/hs_cache.h"
 #include "or/hs_config.h"
 #include "or/torcert.h" /* tor_cert_encode_ed22519() */
+#include "lib/memarea/memarea.h"
 
 #include "or/extend_info_st.h"
 
@@ -2607,4 +2608,3 @@ hs_desc_lspec_to_trunnel(const hs_desc_link_specifier_t *spec)
 
   return ls;
 }
-
diff --git a/src/or/hs_descriptor.h b/src/or/hs_descriptor.h
index d16234969..7a4010cd3 100644
--- a/src/or/hs_descriptor.h
+++ b/src/or/hs_descriptor.h
@@ -12,9 +12,6 @@
 #include <stdint.h>
 
 #include "or/or.h"
-#include "lib/net/address.h"
-#include "lib/crypt_ops/crypto.h"
-#include "lib/crypt_ops/crypto_ed25519.h"
 #include "trunnel/ed25519_cert.h" /* needed for trunnel */
 #include "or/torcert.h"
 
@@ -281,4 +278,3 @@ MOCK_DECL(STATIC size_t, decrypt_desc_layer,(const hs_descriptor_t *desc,
 #endif /* defined(HS_DESCRIPTOR_PRIVATE) */
 
 #endif /* !defined(TOR_HS_DESCRIPTOR_H) */
-
diff --git a/src/or/main.c b/src/or/main.c
index 6a5bf9ae0..19b30f725 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -119,6 +119,7 @@
 #include "lib/tls/tortls.h"
 #include "common/compat_libevent.h"
 #include "lib/encoding/confline.h"
+#include "common/timers.h"
 
 #include <event2/event.h>
 
diff --git a/src/or/onion_ntor.c b/src/or/onion_ntor.c
index 3a60d1b7e..34b111202 100644
--- a/src/or/onion_ntor.c
+++ b/src/or/onion_ntor.c
@@ -27,6 +27,7 @@
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/onion_ntor.h"
 #include "lib/log/torlog.h"
+#include "lib/ctime/di_ops.h"
 #include "common/util.h"
 
 /** Free storage held in an ntor handshake state. */
@@ -335,4 +336,3 @@ onion_skin_ntor_client_handshake(
 
   return bad ? -1 : 0;
 }
-
diff --git a/src/or/onion_ntor.h b/src/or/onion_ntor.h
index b4da3a8d7..4855f9819 100644
--- a/src/or/onion_ntor.h
+++ b/src/or/onion_ntor.h
@@ -6,7 +6,8 @@
 
 #include "lib/cc/torint.h"
 #include "lib/crypt_ops/crypto_curve25519.h"
-#include "lib/ctime/di_ops.h"
+
+struct di_digest256_map_t;
 
 /** State to be maintained by a client between sending an ntor onionskin
  * and receiving a reply. */
@@ -27,7 +28,7 @@ int onion_skin_ntor_create(const uint8_t *router_id,
                            uint8_t *onion_skin_out);
 
 int onion_skin_ntor_server_handshake(const uint8_t *onion_skin,
-                                 const di_digest256_map_t *private_keys,
+                                 const struct di_digest256_map_t *private_keys,
                                  const curve25519_keypair_t *junk_keypair,
                                  const uint8_t *my_node_id,
                                  uint8_t *handshake_reply_out,
@@ -60,4 +61,3 @@ struct ntor_handshake_state_t {
 #endif /* defined(ONION_NTOR_PRIVATE) */
 
 #endif /* !defined(TOR_ONION_NTOR_H) */
-
diff --git a/src/or/parsecommon.c b/src/or/parsecommon.c
index 7c9cf88f9..4340f2822 100644
--- a/src/or/parsecommon.c
+++ b/src/or/parsecommon.c
@@ -13,6 +13,8 @@
 #include "lib/container/smartlist.h"
 #include "lib/string/util_string.h"
 #include "lib/string/printf.h"
+#include "lib/memarea/memarea.h"
+#include "lib/crypt_ops/crypto.h"
 
 #include <string.h>
 
diff --git a/src/or/parsecommon.h b/src/or/parsecommon.h
index 7fe192c2a..d0f3810c0 100644
--- a/src/or/parsecommon.h
+++ b/src/or/parsecommon.h
@@ -9,10 +9,11 @@
 #ifndef TOR_PARSECOMMON_H
 #define TOR_PARSECOMMON_H
 
-#include "lib/crypt_ops/crypto.h"
-#include "lib/memarea/memarea.h"
+#include <stddef.h>
 
 struct smartlist_t;
+struct crypto_pk_t;
+struct memarea_t;
 
 /** Enumeration of possible token types.  The ones starting with K_ correspond
 * to directory 'keywords'. A_ is for an annotation, R or C is related to
@@ -206,7 +207,7 @@ typedef struct directory_token_t {
   size_t object_size;          /**< Bytes in object_body */
   char *object_body;           /**< Contents of object, base64-decoded. */
 
-  crypto_pk_t *key;        /**< For public keys only.  Heap-allocated. */
+  struct crypto_pk_t *key;     /**< For public keys only.  Heap-allocated. */
 
   char *error;                 /**< For ERR_ tokens only. */
 } directory_token_t;
@@ -298,12 +299,12 @@ typedef struct token_rule_t {
 
 void token_clear(directory_token_t *tok);
 
-int tokenize_string(memarea_t *area,
+int tokenize_string(struct memarea_t *area,
                     const char *start, const char *end,
                     struct smartlist_t *out,
                     token_rule_t *table,
                     int flags);
-directory_token_t *get_next_token(memarea_t *area,
+directory_token_t *get_next_token(struct memarea_t *area,
                                   const char **s,
                                   const char *eos,
                                   token_rule_t *table);
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index e5ddb1102..6d0861647 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -16,6 +16,7 @@
 #include "or/circuituse.h"
 #include "or/config.h"
 #include "or/control.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/directory.h"
diff --git a/src/or/rendservice.h b/src/or/rendservice.h
index 0b119e61d..b11a2a7da 100644
--- a/src/or/rendservice.h
+++ b/src/or/rendservice.h
@@ -14,13 +14,12 @@
 
 #include "or/or.h"
 #include "or/hs_service.h"
-#include "lib/crypt_ops/crypto_dh.h"
 
-typedef struct rend_intro_cell_s rend_intro_cell_t;
+typedef struct rend_intro_cell_t rend_intro_cell_t;
 
 /* This can be used for both INTRODUCE1 and INTRODUCE2 */
 
-struct rend_intro_cell_s {
+struct rend_intro_cell_t {
   /* Is this an INTRODUCE1 or INTRODUCE2? (set to 1 or 2) */
   uint8_t type;
   /* Public key digest */
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index ec29c1d30..7e0c33f63 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -20,6 +20,8 @@
 #include "or/networkstatus.h"
 #include "test/log_test_helpers.h"
 #include "lib/tls/tortls.h"
+#include "common/timers.h"
+#include "lib/container/buffers.h"
 
 #include "or/cell_st.h"
 #include "or/networkstatus_st.h"
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 8fbe27cec..804df0f14 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -40,6 +40,7 @@
 #include "or/routerstatus_st.h"
 
 #include "lib/encoding/confline.h"
+#include "lib/container/buffers.h"
 
 #include "test/test.h"
 #include "test/test_dir_common.h"





More information about the tor-commits mailing list