[tor-commits] [tor/master] Remove util.h and compat.h includes from src/common

nickm at torproject.org nickm at torproject.org
Fri Jun 29 16:59:55 UTC 2018


commit 4212a135e1c092a16fc1c4d783495e44d48bbaf9
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jun 29 11:35:49 2018 -0400

    Remove util.h and compat.h includes from src/common
---
 src/common/address_set.c     |  2 --
 src/common/compat.h          | 11 -----------
 src/common/compat_libevent.c |  7 +++----
 src/common/compat_libevent.h |  3 ++-
 src/common/handles.h         |  6 +++---
 src/common/procmon.h         |  1 -
 src/common/timers.c          |  7 ++++---
 src/common/token_bucket.c    |  5 ++++-
 src/common/workqueue.c       | 16 +++++++++-------
 src/common/workqueue.h       |  3 +--
 10 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/src/common/address_set.c b/src/common/address_set.c
index 4e14021eb..1bd146238 100644
--- a/src/common/address_set.c
+++ b/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
diff --git a/src/common/compat.h b/src/common/compat.h
deleted file mode 100644
index b9e4af855..000000000
--- a/src/common/compat.h
+++ /dev/null
@@ -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) */
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index a0b9bc535..9d21cf20b 100644
--- a/src/common/compat_libevent.c
+++ b/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) */
-
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 4b2672b7b..0a50cfa66 100644
--- a/src/common/compat_libevent.h
+++ b/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) */
-
diff --git a/src/common/handles.h b/src/common/handles.h
index ca345b0bc..21ec0dfee 100644
--- a/src/common/handles.h
+++ b/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) */
-
diff --git a/src/common/procmon.h b/src/common/procmon.h
index 246ddd71d..b8daeed0d 100644
--- a/src/common/procmon.h
+++ b/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"
diff --git a/src/common/timers.c b/src/common/timers.c
index 72562f4cf..57b7d7265 100644
--- a/src/common/timers.c
+++ b/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. */
 }
-
diff --git a/src/common/token_bucket.c b/src/common/token_bucket.c
index 3a16720d7..f7b092f61 100644
--- a/src/common/token_bucket.c
+++ b/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.
diff --git a/src/common/workqueue.c b/src/common/workqueue.c
index 7b030052c..e5254396f 100644
--- a/src/common/workqueue.c
+++ b/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>
 
diff --git a/src/common/workqueue.h b/src/common/workqueue.h
index 1e0efcb1a..4e5c424be 100644
--- a/src/common/workqueue.h
+++ b/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) */
-





More information about the tor-commits mailing list