[tor-commits] [tor/master] Rename authcert_members.i to .h, and have it define a macro.

nickm at torproject.org nickm at torproject.org
Thu Oct 17 12:25:20 UTC 2019


commit 87afe5c2608cc5d4c7a5629024777cee629a0f78
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Oct 16 10:53:01 2019 -0400

    Rename authcert_members.i to .h, and have it define a macro.
    
    Including a file in the middle of a declaration seems to confuse
    Doxygen, and Coccinelle doesn't much like it either.l
---
 src/core/include.am                     |  2 +-
 src/feature/dirparse/authcert_members.h | 29 +++++++++++++++++++++++++++++
 src/feature/dirparse/authcert_members.i | 13 -------------
 src/feature/dirparse/authcert_parse.c   |  3 ++-
 src/feature/dirparse/ns_parse.c         |  3 ++-
 5 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/src/core/include.am b/src/core/include.am
index 9b4b251c8..a0a546f78 100644
--- a/src/core/include.am
+++ b/src/core/include.am
@@ -353,7 +353,7 @@ noinst_HEADERS +=					\
 	src/feature/dircommon/fp_pair.h			\
 	src/feature/dircommon/vote_timing_st.h		\
 	src/feature/dircommon/voting_schedule.h		\
-	src/feature/dirparse/authcert_members.i		\
+	src/feature/dirparse/authcert_members.h		\
 	src/feature/dirparse/authcert_parse.h		\
 	src/feature/dirparse/microdesc_parse.h		\
 	src/feature/dirparse/ns_parse.h			\
diff --git a/src/feature/dirparse/authcert_members.h b/src/feature/dirparse/authcert_members.h
new file mode 100644
index 000000000..8f6fdf17c
--- /dev/null
+++ b/src/feature/dirparse/authcert_members.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2019, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file authcert_members.h
+ *
+ * @brief List of tokens common to V3 authority certificates and V3
+ * consensuses.
+ **/
+
+#ifndef TOR_AUTHCERT_MEMBERS_H
+#define TOR_AUTHCERT_MEMBERS_H
+
+#define AUTHCERT_MEMBERS                                           \
+  T1("dir-key-certificate-version", K_DIR_KEY_CERTIFICATE_VERSION,      \
+                                                     GE(1),       NO_OBJ ), \
+  T1("dir-identity-key", K_DIR_IDENTITY_KEY,         NO_ARGS,     NEED_KEY ),\
+  T1("dir-key-published",K_DIR_KEY_PUBLISHED,        CONCAT_ARGS, NO_OBJ),\
+  T1("dir-key-expires",  K_DIR_KEY_EXPIRES,          CONCAT_ARGS, NO_OBJ),\
+  T1("dir-signing-key",  K_DIR_SIGNING_KEY,          NO_ARGS,     NEED_KEY ),\
+  T1("dir-key-crosscert", K_DIR_KEY_CROSSCERT,       NO_ARGS,     NEED_OBJ ),\
+  T1("dir-key-certification", K_DIR_KEY_CERTIFICATION,\
+                                                     NO_ARGS,     NEED_OBJ),\
+  T01("dir-address",     K_DIR_ADDRESS,              GE(1),       NO_OBJ)
+
+#endif
diff --git a/src/feature/dirparse/authcert_members.i b/src/feature/dirparse/authcert_members.i
deleted file mode 100644
index 08cffca97..000000000
--- a/src/feature/dirparse/authcert_members.i
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * List of tokens common to V3 authority certificates and V3 consensuses.
- */
-  T1("dir-key-certificate-version", K_DIR_KEY_CERTIFICATE_VERSION,
-                                                     GE(1),       NO_OBJ ),
-  T1("dir-identity-key", K_DIR_IDENTITY_KEY,         NO_ARGS,     NEED_KEY ),
-  T1("dir-key-published",K_DIR_KEY_PUBLISHED,        CONCAT_ARGS, NO_OBJ),
-  T1("dir-key-expires",  K_DIR_KEY_EXPIRES,          CONCAT_ARGS, NO_OBJ),
-  T1("dir-signing-key",  K_DIR_SIGNING_KEY,          NO_ARGS,     NEED_KEY ),
-  T1("dir-key-crosscert", K_DIR_KEY_CROSSCERT,       NO_ARGS,     NEED_OBJ ),
-  T1("dir-key-certification", K_DIR_KEY_CERTIFICATION,
-                                                     NO_ARGS,     NEED_OBJ),
-  T01("dir-address",     K_DIR_ADDRESS,              GE(1),       NO_OBJ),
diff --git a/src/feature/dirparse/authcert_parse.c b/src/feature/dirparse/authcert_parse.c
index 8ba5a5398..d22293e28 100644
--- a/src/feature/dirparse/authcert_parse.c
+++ b/src/feature/dirparse/authcert_parse.c
@@ -13,10 +13,11 @@
 #include "lib/memarea/memarea.h"
 
 #include "feature/nodelist/authority_cert_st.h"
+#include "feature/dirparse/authcert_members.h"
 
 /** List of tokens recognized in V3 authority certificates. */
 static token_rule_t dir_key_certificate_table[] = {
-#include "feature/dirparse/authcert_members.i"
+  AUTHCERT_MEMBERS,
   T1("fingerprint",      K_FINGERPRINT,              CONCAT_ARGS, NO_OBJ ),
   END_OF_TABLE
 };
diff --git a/src/feature/dirparse/ns_parse.c b/src/feature/dirparse/ns_parse.c
index d5405e646..4bb579809 100644
--- a/src/feature/dirparse/ns_parse.c
+++ b/src/feature/dirparse/ns_parse.c
@@ -36,6 +36,7 @@
 #include "feature/nodelist/networkstatus_st.h"
 #include "feature/nodelist/networkstatus_voter_info_st.h"
 #include "feature/nodelist/vote_routerstatus_st.h"
+#include "feature/dirparse/authcert_members.h"
 
 #undef log
 #include <math.h>
@@ -84,7 +85,7 @@ static token_rule_t networkstatus_token_table[] = {
   T01("required-relay-protocols",    K_REQUIRED_RELAY_PROTOCOLS,
       CONCAT_ARGS, NO_OBJ ),
 
-#include "feature/dirparse/authcert_members.i"
+  AUTHCERT_MEMBERS,
 
   T0N("opt",                 K_OPT,             CONCAT_ARGS, OBJ_OK ),
   T1( "contact",             K_CONTACT,         CONCAT_ARGS, NO_OBJ ),





More information about the tor-commits mailing list