[tor-commits] [tor/master] Remove the PORT configuration type: nothing uses it.

dgoulet at torproject.org dgoulet at torproject.org
Wed Jun 19 11:50:56 UTC 2019


commit fe9d15cf4b392bd6daef47f3aab97adeeebe7402
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jun 12 16:33:40 2019 -0400

    Remove the PORT configuration type: nothing uses it.
    
    All of our port configurations now use an extended format.
---
 src/app/config/config.c    |  1 -
 src/app/config/confparse.c | 16 +---------------
 src/app/config/confparse.h |  8 +++-----
 3 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/src/app/config/config.c b/src/app/config/config.c
index 847355dad..790800705 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -8180,7 +8180,6 @@ getinfo_helper_config(control_connection_t *conn,
         case CONFIG_TYPE_POSINT: type = "Integer"; break;
         case CONFIG_TYPE_UINT64: type = "Integer"; break;
         case CONFIG_TYPE_INT: type = "SignedInteger"; break;
-        case CONFIG_TYPE_PORT: type = "Port"; break;
         case CONFIG_TYPE_INTERVAL: type = "TimeInterval"; break;
         case CONFIG_TYPE_MSEC_INTERVAL: type = "TimeMsecInterval"; break;
         case CONFIG_TYPE_MEMUNIT: type = "DataSize"; break;
diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c
index cf83df728..14d9a368d 100644
--- a/src/app/config/confparse.c
+++ b/src/app/config/confparse.c
@@ -174,17 +174,11 @@ config_assign_value(const config_format_t *fmt, void *options,
 
   switch (var->type) {
 
-  case CONFIG_TYPE_PORT:
-    if (!strcasecmp(c->value, "auto")) {
-      *(int *)lvalue = CFG_AUTO_PORT;
-      break;
-    }
-    /* fall through */
   case CONFIG_TYPE_INT:
   case CONFIG_TYPE_POSINT:
     i = (int)tor_parse_long(c->value, 10,
                             var->type==CONFIG_TYPE_INT ? INT_MIN : 0,
-                            var->type==CONFIG_TYPE_PORT ? 65535 : INT_MAX,
+                            INT_MAX,
                             &ok, NULL);
     if (!ok) {
       tor_asprintf(msg,
@@ -570,13 +564,6 @@ config_get_assigned_option(const config_format_t *fmt, const void *options,
       }
       escape_val = 0; /* Can't need escape. */
       break;
-    case CONFIG_TYPE_PORT:
-      if (*(int*)value == CFG_AUTO_PORT) {
-        result->value = tor_strdup("auto");
-        escape_val = 0;
-        break;
-      }
-      /* fall through */
     case CONFIG_TYPE_CSV_INTERVAL:
     case CONFIG_TYPE_INTERVAL:
     case CONFIG_TYPE_MSEC_INTERVAL:
@@ -788,7 +775,6 @@ config_clear(const config_format_t *fmt, void *options,
     case CONFIG_TYPE_MSEC_INTERVAL:
     case CONFIG_TYPE_POSINT:
     case CONFIG_TYPE_INT:
-    case CONFIG_TYPE_PORT:
     case CONFIG_TYPE_BOOL:
       *(int*)lvalue = 0;
       break;
diff --git a/src/app/config/confparse.h b/src/app/config/confparse.h
index 57f1ec176..2c923eb6b 100644
--- a/src/app/config/confparse.h
+++ b/src/app/config/confparse.h
@@ -17,11 +17,9 @@
 typedef enum config_type_t {
   CONFIG_TYPE_STRING = 0,   /**< An arbitrary string. */
   CONFIG_TYPE_FILENAME,     /**< A filename: some prefixes get expanded. */
-  CONFIG_TYPE_UINT,         /**< A non-negative integer less than MAX_INT */
+  CONFIG_TYPE_POSINT,         /**< A non-negative integer less than MAX_INT */
   CONFIG_TYPE_INT,          /**< Any integer. */
   CONFIG_TYPE_UINT64,       /**< A value in range 0..UINT64_MAX */
-  CONFIG_TYPE_PORT,         /**< A port from 1...65535, 0 for "not set", or
-                             * "auto".  */
   CONFIG_TYPE_INTERVAL,     /**< A number of seconds, with optional units*/
   CONFIG_TYPE_MSEC_INTERVAL,/**< A number of milliseconds, with optional
                               * units */
@@ -57,8 +55,8 @@ typedef enum config_type_t {
 typedef union {
   char **STRING;
   char **FILENAME;
-  int *UINT; /* yes, really: Even though the confparse type is called
-              * "UINT", it still uses the C int type -- it just enforces that
+  int *POSINT; /* yes, really: Even though the confparse type is called
+              * "POSINT", it still uses the C int type -- it just enforces that
               * the values are in range [0,INT_MAX].
               */
   uint64_t *UINT64;





More information about the tor-commits mailing list