[tor-commits] [tor/master] Extract tor_version_t into its own header.

nickm at torproject.org nickm at torproject.org
Mon Jun 18 18:18:42 UTC 2018


commit 7d2d131afad17375a7e04086082568903d5335d2
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jun 15 12:12:15 2018 -0400

    Extract tor_version_t into its own header.
---
 src/or/dirserv.c        |  1 +
 src/or/include.am       |  3 ++-
 src/or/or.h             | 23 +----------------------
 src/or/routerparse.c    |  2 ++
 src/or/tor_version_st.h | 32 ++++++++++++++++++++++++++++++++
 src/test/test_dir.c     |  1 +
 6 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f2597aeae..038b47e01 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -37,6 +37,7 @@
 #include "dirauth/dirvote.h"
 
 #include "dir_connection_st.h"
+#include "tor_version_st.h"
 
 /**
  * \file dirserv.c
diff --git a/src/or/include.am b/src/or/include.am
index e38013f02..618ffacd0 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -260,7 +260,7 @@ ORHEADERS = \
 	src/or/or_handshake_state_st.h			\
 	src/or/origin_circuit_st.h			\
 	src/or/transports.h				\
-	src/or/parsecommon.h			\
+	src/or/parsecommon.h				\
 	src/or/periodic.h				\
 	src/or/port_cfg_st.h				\
 	src/or/policies.h				\
@@ -294,6 +294,7 @@ ORHEADERS = \
 	src/or/status.h					\
 	src/or/torcert.h				\
 	src/or/tor_api_internal.h			\
+	src/or/tor_version_st.h				\
 	src/or/voting_schedule.h
 
 # We add the headers of the modules even though they are disabled so we can
diff --git a/src/or/or.h b/src/or/or.h
index 4403aae83..b67896d2a 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4261,28 +4261,7 @@ typedef enum was_router_added_t {
   ROUTER_CERTS_EXPIRED = -8
 } was_router_added_t;
 
-/********************************* routerparse.c ************************/
-
-#define MAX_STATUS_TAG_LEN 32
-/** Structure to hold parsed Tor versions.  This is a little messier
- * than we would like it to be, because we changed version schemes with 0.1.0.
- *
- * See version-spec.txt for the whole business.
- */
-typedef struct tor_version_t {
-  int major;
-  int minor;
-  int micro;
-  /** Release status.  For version in the post-0.1 format, this is always
-   * VER_RELEASE. */
-  enum { VER_PRE=0, VER_RC=1, VER_RELEASE=2, } status;
-  int patchlevel;
-  char status_tag[MAX_STATUS_TAG_LEN];
-  int svn_revision;
-
-  int git_tag_len;
-  char git_tag[DIGEST_LEN];
-} tor_version_t;
+typedef struct tor_version_t tor_version_t;
 
 #endif /* !defined(TOR_OR_H) */
 
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 7af41c3ba..06a37904d 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -84,6 +84,8 @@
 
 #include "dirauth/dirvote.h"
 
+#include "tor_version_st.h"
+
 /****************************************************************************/
 
 /** List of tokens recognized in router descriptors */
diff --git a/src/or/tor_version_st.h b/src/or/tor_version_st.h
new file mode 100644
index 000000000..8c33602ef
--- /dev/null
+++ b/src/or/tor_version_st.h
@@ -0,0 +1,32 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_VERSION_ST_H
+#define TOR_VERSION_ST_H
+
+#define MAX_STATUS_TAG_LEN 32
+/** Structure to hold parsed Tor versions.  This is a little messier
+ * than we would like it to be, because we changed version schemes with 0.1.0.
+ *
+ * See version-spec.txt for the whole business.
+ */
+struct tor_version_t {
+  int major;
+  int minor;
+  int micro;
+  /** Release status.  For version in the post-0.1 format, this is always
+   * VER_RELEASE. */
+  enum { VER_PRE=0, VER_RC=1, VER_RELEASE=2, } status;
+  int patchlevel;
+  char status_tag[MAX_STATUS_TAG_LEN];
+  int svn_revision;
+
+  int git_tag_len;
+  char git_tag[DIGEST_LEN];
+};
+
+#endif
+
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 538fb8db1..5bcbc80e8 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -45,6 +45,7 @@
 #include "voting_schedule.h"
 
 #include "port_cfg_st.h"
+#include "tor_version_st.h"
 
 #define NS_MODULE dir
 





More information about the tor-commits mailing list