[tor-commits] [tor/master] Avoid redundant typedef of or_options_t and smartlist_t in *_config.h

teor at torproject.org teor at torproject.org
Fri Nov 15 01:28:54 UTC 2019


commit d57a04b6481a0cccd475c31ed5547767c4b9df89
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Nov 14 10:52:21 2019 -0500

    Avoid redundant typedef of or_options_t and smartlist_t in *_config.h
    
    Fixes bug 32495.
---
 src/feature/dirauth/dirauth_config.h | 28 +++++++-------
 src/feature/relay/relay_config.h     | 72 ++++++++++++++++++------------------
 src/feature/relay/transport_config.h | 18 ++++-----
 3 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/src/feature/dirauth/dirauth_config.h b/src/feature/dirauth/dirauth_config.h
index 655ab0a7f..b494ca685 100644
--- a/src/feature/dirauth/dirauth_config.h
+++ b/src/feature/dirauth/dirauth_config.h
@@ -12,31 +12,31 @@
 #ifndef TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
 #define TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
 
-typedef struct or_options_t or_options_t;
+struct or_options_t;
 
 #ifdef HAVE_MODULE_DIRAUTH
 
 #include "lib/cc/torint.h"
 
-int options_validate_dirauth_mode(const or_options_t *old_options,
-                                  or_options_t *options,
+int options_validate_dirauth_mode(const struct or_options_t *old_options,
+                                  struct or_options_t *options,
                                   char **msg);
 
-int options_validate_dirauth_bandwidth(const or_options_t *old_options,
-                                       or_options_t *options,
+int options_validate_dirauth_bandwidth(const struct or_options_t *old_options,
+                                       struct or_options_t *options,
                                        char **msg);
 
-int options_validate_dirauth_schedule(const or_options_t *old_options,
-                                      or_options_t *options,
+int options_validate_dirauth_schedule(const struct or_options_t *old_options,
+                                      struct or_options_t *options,
                                       char **msg);
 
-int options_validate_dirauth_testing(const or_options_t *old_options,
-                                     or_options_t *options,
+int options_validate_dirauth_testing(const struct or_options_t *old_options,
+                                     struct or_options_t *options,
                                      char **msg);
 
-int options_act_dirauth(const or_options_t *old_options);
-int options_act_dirauth_mtbf(const or_options_t *old_options);
-int options_act_dirauth_stats(const or_options_t *old_options,
+int options_act_dirauth(const struct or_options_t *old_options);
+int options_act_dirauth_mtbf(const struct or_options_t *old_options);
+int options_act_dirauth_stats(const struct or_options_t *old_options,
                               bool *print_notice_out);
 
 #else /* !defined(HAVE_MODULE_DIRAUTH) */
@@ -47,8 +47,8 @@ int options_act_dirauth_stats(const or_options_t *old_options,
  * Returns -1 and sets msg to a newly allocated string, if AuthoritativeDir
  * is set in options. Otherwise returns 0. */
 static inline int
-options_validate_dirauth_mode(const or_options_t *old_options,
-                              or_options_t *options,
+options_validate_dirauth_mode(const struct or_options_t *old_options,
+                              struct or_options_t *options,
                               char **msg)
 {
   (void)old_options;
diff --git a/src/feature/relay/relay_config.h b/src/feature/relay/relay_config.h
index 5c36b43bd..57e6ddf94 100644
--- a/src/feature/relay/relay_config.h
+++ b/src/feature/relay/relay_config.h
@@ -12,80 +12,80 @@
 #ifndef TOR_FEATURE_RELAY_RELAY_CONFIG_H
 #define TOR_FEATURE_RELAY_RELAY_CONFIG_H
 
-typedef struct or_options_t or_options_t;
+struct or_options_t;
 
 #ifdef HAVE_MODULE_RELAY
 
 #include "lib/cc/torint.h"
 #include "lib/testsupport/testsupport.h"
 
-typedef struct smartlist_t smartlist_t;
+struct smartlist_t;
 
-int options_validate_relay_mode(const or_options_t *old_options,
-                                or_options_t *options,
+int options_validate_relay_mode(const struct or_options_t *old_options,
+                                struct or_options_t *options,
                                 char **msg);
 
 MOCK_DECL(const char*, relay_get_dirportfrontpage, (void));
 void relay_config_free_all(void);
 
-uint32_t relay_get_effective_bwrate(const or_options_t *options);
-uint32_t relay_get_effective_bwburst(const or_options_t *options);
+uint32_t relay_get_effective_bwrate(const struct or_options_t *options);
+uint32_t relay_get_effective_bwburst(const struct or_options_t *options);
 
-void port_warn_nonlocal_ext_orports(const smartlist_t *ports,
+void port_warn_nonlocal_ext_orports(const struct smartlist_t *ports,
                                const char *portname);
 
-int port_parse_ports_relay(or_options_t *options,
+int port_parse_ports_relay(struct or_options_t *options,
                       char **msg,
-                      smartlist_t *ports_out,
+                      struct smartlist_t *ports_out,
                       int *have_low_ports_out);
-void port_update_port_set_relay(or_options_t *options,
-                           const smartlist_t *ports);
+void port_update_port_set_relay(struct or_options_t *options,
+                           const struct smartlist_t *ports);
 
-int options_validate_relay_os(const or_options_t *old_options,
-                              or_options_t *options,
+int options_validate_relay_os(const struct or_options_t *old_options,
+                              struct or_options_t *options,
                               char **msg);
 
-int options_validate_relay_info(const or_options_t *old_options,
-                                or_options_t *options,
+int options_validate_relay_info(const struct or_options_t *old_options,
+                                struct or_options_t *options,
                                 char **msg);
 
-int options_validate_publish_server(const or_options_t *old_options,
-                                    or_options_t *options,
+int options_validate_publish_server(const struct or_options_t *old_options,
+                                    struct or_options_t *options,
                                     char **msg);
 
-int options_validate_relay_padding(const or_options_t *old_options,
-                                   or_options_t *options,
+int options_validate_relay_padding(const struct or_options_t *old_options,
+                                   struct or_options_t *options,
                                    char **msg);
 
-int options_validate_relay_bandwidth(const or_options_t *old_options,
-                                     or_options_t *options,
+int options_validate_relay_bandwidth(const struct or_options_t *old_options,
+                                     struct or_options_t *options,
                                      char **msg);
 
-int options_validate_relay_accounting(const or_options_t *old_options,
-                                      or_options_t *options,
+int options_validate_relay_accounting(const struct or_options_t *old_options,
+                                      struct or_options_t *options,
                                       char **msg);
 
-int options_validate_relay_testing(const or_options_t *old_options,
-                                   or_options_t *options,
+int options_validate_relay_testing(const struct or_options_t *old_options,
+                                   struct or_options_t *options,
                                    char **msg);
 
-int options_act_relay(const or_options_t *old_options);
-int options_act_relay_accounting(const or_options_t *old_options);
-int options_act_relay_bandwidth(const or_options_t *old_options);
-int options_act_bridge_stats(const or_options_t *old_options);
+int options_act_relay(const struct or_options_t *old_options);
+int options_act_relay_accounting(const struct or_options_t *old_options);
+int options_act_relay_bandwidth(const struct or_options_t *old_options);
+int options_act_bridge_stats(const struct or_options_t *old_options);
 
-int options_act_relay_stats(const or_options_t *old_options,
+int options_act_relay_stats(const struct or_options_t *old_options,
                             bool *print_notice_out);
 void options_act_relay_stats_msg(void);
 
-int options_act_relay_desc(const or_options_t *old_options);
-int options_act_relay_dos(const or_options_t *old_options);
-int options_act_relay_dir(const or_options_t *old_options);
+int options_act_relay_desc(const struct or_options_t *old_options);
+int options_act_relay_dos(const struct or_options_t *old_options);
+int options_act_relay_dir(const struct or_options_t *old_options);
 
 #ifdef RELAY_CONFIG_PRIVATE
 
 STATIC int check_bridge_distribution_setting(const char *bd);
-STATIC int have_enough_mem_for_dircache(const or_options_t *options,
+STATIC int have_enough_mem_for_dircache(const struct or_options_t *options,
                                         size_t total_mem, char **msg);
 
 #endif /* defined(RELAY_CONFIG_PRIVATE) */
@@ -102,8 +102,8 @@ STATIC int have_enough_mem_for_dircache(const or_options_t *options,
  * Returns -1 and sets msg to a newly allocated string, if ORPort, DirPort,
  * DirCache, or BridgeRelay are set in options. Otherwise returns 0. */
 static inline int
-options_validate_relay_mode(const or_options_t *old_options,
-                            or_options_t *options,
+options_validate_relay_mode(const struct or_options_t *old_options,
+                            struct or_options_t *options,
                             char **msg)
 {
   (void)old_options;
diff --git a/src/feature/relay/transport_config.h b/src/feature/relay/transport_config.h
index d3cceb369..38f804b4b 100644
--- a/src/feature/relay/transport_config.h
+++ b/src/feature/relay/transport_config.h
@@ -16,21 +16,21 @@
 
 #include "lib/testsupport/testsupport.h"
 
-typedef struct or_options_t or_options_t;
-typedef struct smartlist_t smartlist_t;
+struct or_options_t;
+struct smartlist_t;
 
-int options_validate_server_transport(const or_options_t *old_options,
-                                      or_options_t *options,
+int options_validate_server_transport(const struct or_options_t *old_options,
+                                      struct or_options_t *options,
                                       char **msg);
 
 char *pt_get_bindaddr_from_config(const char *transport);
-smartlist_t *pt_get_options_for_server_transport(const char *transport);
+struct smartlist_t *pt_get_options_for_server_transport(const char *transport);
 
-int options_act_server_transport(const or_options_t *old_options);
+int options_act_server_transport(const struct or_options_t *old_options);
 
 #ifdef RELAY_TRANSPORT_CONFIG_PRIVATE
 
-STATIC smartlist_t *get_options_from_transport_options_line(
+STATIC struct smartlist_t *get_options_from_transport_options_line(
                       const char *line,
                       const char *transport);
 
@@ -45,8 +45,8 @@ STATIC smartlist_t *get_options_from_transport_options_line(
  * ServerTransportPlugin, ServerTransportListenAddr, or
  * ServerTransportOptions are set in options. Otherwise returns 0. */
 static inline int
-options_validate_server_transport(const or_options_t *old_options,
-                                  or_options_t *options,
+options_validate_server_transport(const struct or_options_t *old_options,
+                                  struct or_options_t *options,
                                   char **msg)
 {
   (void)old_options;





More information about the tor-commits mailing list