[tor-commits] [tor/master] Address review comments from cypherpunks

nickm at torproject.org nickm at torproject.org
Fri Jul 8 14:06:49 UTC 2016


commit bd1a85cc91eaa7aa148461274704cde999d8af2b
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Mon Jul 4 16:27:46 2016 +0200

    Address review comments from cypherpunks
---
 src/common/compat_libevent.c |  7 ++-----
 src/common/compat_libevent.h | 25 +++++++------------------
 src/common/procmon.c         |  6 +-----
 3 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 1d0bfb9..c5f73dc 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -3,11 +3,8 @@
 
 /**
  * \file compat_libevent.c
- * \brief Wrappers to handle porting between different versions of libevent.
- *
- * In an ideal world, we'd just use Libevent 2.0 from now on.  But as of June
- * 2012, Libevent 1.4 is still all over, and some poor souls are stuck on
- * Libevent 1.3e. */
+ * \brief Wrappers and utility functions for Libevent.
+ */
 
 #include "orconfig.h"
 #include "compat.h"
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index e46c2d5..89b35c9 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -7,16 +7,12 @@
 #include "orconfig.h"
 #include "testsupport.h"
 
-struct event;
-struct event_base;
+#include <event2/event.h>
+
 #ifdef USE_BUFFEREVENTS
-struct bufferevent;
-struct ev_token_bucket_cfg;
-struct bufferevent_rate_limit_group;
+#include <event2/bufferevent.h>
 #endif
 
-#include <event2/util.h>
-
 void configure_libevent_logging(void);
 void suppress_libevent_log_msg(const char *msg);
 
@@ -77,22 +73,15 @@ void tor_gettimeofday_cache_set(const struct timeval *tv);
 void tor_gettimeofday_cached_monotonic(struct timeval *tv);
 
 #ifdef COMPAT_LIBEVENT_PRIVATE
-/** A number representing a version of Libevent.
 
-    This is a 4-byte number, with the first three bytes representing the
-    major, minor, and patchlevel respectively of the library.  The fourth
-    byte is unused.
+/** Macro: returns the number of a Libevent version as a 4-byte number,
+    with the first three bytes representing the major, minor, and patchlevel
+    respectively of the library.  The fourth byte is unused.
 
     This is equivalent to the format of LIBEVENT_VERSION_NUMBER on Libevent
-    2.0.1 or later.
-*/
-typedef uint32_t le_version_t;
-
-/** @{ */
-/** Macros: returns the number of a libevent version as a le_version_t */
+    2.0.1 or later. */
 #define V(major, minor, patch) \
   (((major) << 24) | ((minor) << 16) | ((patch) << 8))
-/** @} */
 
 STATIC void
 libevent_logging_callback(int severity, const char *msg);
diff --git a/src/common/procmon.c b/src/common/procmon.c
index 466044d..c485c76 100644
--- a/src/common/procmon.c
+++ b/src/common/procmon.c
@@ -163,11 +163,7 @@ tor_validate_process_specifier(const char *process_spec,
 #define PERIODIC_TIMER_FLAGS EV_PERSIST
 
 /* DOCDOC poll_interval_tv */
-static struct timeval poll_interval_tv = {15, 0};
-/* Note: If you port this file to plain Libevent 2, you can make
- * poll_interval_tv const.  It has to be non-const here because in
- * libevent 1.x, event_add expects a pointer to a non-const struct
- * timeval. */
+static const struct timeval poll_interval_tv = {15, 0};
 
 /** Create a process-termination monitor for the process specifier
  * given in <b>process_spec</b>.  Return a newly allocated





More information about the tor-commits mailing list