Browse Source

Remove util.h and compat.h includes from src/common

Nick Mathewson 5 years ago
parent
commit
4212a135e1

+ 0 - 2
src/common/address_set.c

@@ -13,10 +13,8 @@
 #include "orconfig.h"
 #include "common/address_set.h"
 #include "lib/net/address.h"
-#include "common/compat.h"
 #include "lib/container/bloomfilt.h"
 #include "lib/crypt_ops/crypto_rand.h"
-#include "common/util.h"
 #include "siphash.h"
 
 /* Wrap our hash function to have the signature that the bloom filter

+ 0 - 11
src/common/compat.h

@@ -1,11 +0,0 @@
-/* Copyright (c) 2003-2004, Roger Dingledine
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2018, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-#ifndef TOR_COMPAT_H
-#define TOR_COMPAT_H
-
-#include "common/util.h"
-
-#endif /* !defined(TOR_COMPAT_H) */

+ 3 - 4
src/common/compat_libevent.c

@@ -7,17 +7,17 @@
  */
 
 #include "orconfig.h"
-#include "common/compat.h"
 #define COMPAT_LIBEVENT_PRIVATE
 #include "common/compat_libevent.h"
 
 #include "lib/crypt_ops/crypto_rand.h"
-
-#include "common/util.h"
 #include "lib/log/torlog.h"
+#include "lib/log/util_bug.h"
+#include "lib/string/compat_string.h"
 
 #include <event2/event.h>
 #include <event2/thread.h>
+#include <string.h>
 
 /** A string which, if it appears in a libevent log, should be ignored. */
 static const char *suppress_msg = NULL;
@@ -533,4 +533,3 @@ tor_libevent_postfork(void)
   tor_assert(r == 0);
 }
 #endif /* defined(TOR_UNIT_TESTS) */
-

+ 2 - 1
src/common/compat_libevent.h

@@ -6,6 +6,7 @@
 
 #include "orconfig.h"
 #include "lib/testsupport/testsupport.h"
+#include "lib/malloc/util_malloc.h"
 
 void configure_libevent_logging(void);
 void suppress_libevent_log_msg(const char *msg);
@@ -19,6 +20,7 @@ void suppress_libevent_log_msg(const char *msg);
 
 struct event;
 struct event_base;
+struct timeval;
 
 void tor_event_free_(struct event *ev);
 #define tor_event_free(ev) \
@@ -95,4 +97,3 @@ libevent_logging_callback(int severity, const char *msg);
 #endif /* defined(COMPAT_LIBEVENT_PRIVATE) */
 
 #endif /* !defined(TOR_COMPAT_LIBEVENT_H) */
-

+ 3 - 3
src/common/handles.h

@@ -50,8 +50,9 @@
 #define TOR_HANDLE_H
 
 #include "orconfig.h"
-#include "tor_queue.h"
-#include "common/util.h"
+
+#include "lib/log/util_bug.h"
+#include "lib/malloc/util_malloc.h"
 
 #define HANDLE_ENTRY(name, structname)         \
   struct name ## _handle_head_t *handle_head
@@ -150,4 +151,3 @@
   }
 
 #endif /* !defined(TOR_HANDLE_H) */
-

+ 0 - 1
src/common/procmon.h

@@ -9,7 +9,6 @@
 #ifndef TOR_PROCMON_H
 #define TOR_PROCMON_H
 
-#include "common/compat.h"
 #include "common/compat_libevent.h"
 
 #include "lib/log/torlog.h"

+ 4 - 3
src/common/timers.c

@@ -31,11 +31,13 @@
 
 #define TOR_TIMERS_PRIVATE
 
-#include "common/compat.h"
 #include "common/compat_libevent.h"
 #include "common/timers.h"
+#include "lib/intmath/muldiv.h"
 #include "lib/log/torlog.h"
-#include "common/util.h"
+#include "lib/log/util_bug.h"
+#include "lib/malloc/util_malloc.h"
+#include "lib/time/compat_time.h"
 
 struct timeout_cb {
   timer_cb_fn_t cb;
@@ -315,4 +317,3 @@ timer_disable(tor_timer_t *t)
   /* We don't reschedule the libevent timer here, since it's okay if it fires
    * early. */
 }
-

+ 4 - 1
src/common/token_bucket.c

@@ -19,8 +19,11 @@
 #define TOKEN_BUCKET_PRIVATE
 
 #include "common/token_bucket.h"
-#include "common/compat.h"
 #include "lib/log/util_bug.h"
+#include "lib/intmath/cmp.h"
+#include "lib/time/compat_time.h"
+
+#include <string.h>
 
 /**
  * Set the <b>rate</b> and <b>burst</b> value in a token_bucket_cfg.

+ 9 - 7
src/common/workqueue.c

@@ -24,17 +24,19 @@
  */
 
 #include "orconfig.h"
-#include "common/compat.h"
 #include "common/compat_libevent.h"
-#include "lib/thread/threads.h"
-#include "lib/crypt_ops/crypto_rand.h"
-#include "common/util.h"
 #include "common/workqueue.h"
-#include "tor_queue.h"
-#include "lib/net/alertsock.h"
-#include "lib/log/torlog.h"
+
+#include "lib/crypt_ops/crypto_rand.h"
 #include "lib/intmath/weakrng.h"
+#include "lib/log/ratelim.h"
+#include "lib/log/torlog.h"
+#include "lib/log/util_bug.h"
+#include "lib/net/alertsock.h"
+#include "lib/net/socket.h"
+#include "lib/thread/threads.h"
 
+#include "tor_queue.h"
 #include <event2/event.h>
 #include <string.h>
 

+ 1 - 2
src/common/workqueue.h

@@ -4,7 +4,7 @@
 #ifndef TOR_WORKQUEUE_H
 #define TOR_WORKQUEUE_H
 
-#include "common/compat.h"
+#include "lib/cc/torint.h"
 
 /** A replyqueue is used to tell the main thread about the outcome of
  * work that we queued for the workers. */
@@ -63,4 +63,3 @@ int threadpool_register_reply_event(threadpool_t *tp,
                                     void (*cb)(threadpool_t *tp));
 
 #endif /* !defined(TOR_WORKQUEUE_H) */
-