[tor-commits] [tor/master] Rename TAKES_NO_ARGUMENT to ARGUMENT_NONE.

nickm at torproject.org nickm at torproject.org
Thu Oct 17 16:01:55 UTC 2019


commit 4c25ea6703296d068a133da9821643f87c5f5316
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Oct 8 10:46:16 2019 -0400

    Rename TAKES_NO_ARGUMENT to ARGUMENT_NONE.
    
    I'm doing this for consistency, so that all the values for this enum
    have the same prefix.
    
    This is an automated commit, generated by the following shell commands:
    
    for fn in $(git ls-tree --name-only -r HEAD src |grep '\.[ch]$'); do \
        perl -i -pe 's!\bTAKES_NO_ARGUMENT\b!ARGUMENT_NONE!g;' "$fn"; \
    done
---
 src/app/config/config.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/app/config/config.c b/src/app/config/config.c
index deda2448b..561fc6545 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -2448,7 +2448,7 @@ options_act(const or_options_t *old_options)
 }
 
 typedef enum {
-  TAKES_NO_ARGUMENT = 0,
+  ARGUMENT_NONE = 0,
   ARGUMENT_NECESSARY = 1,
   ARGUMENT_OPTIONAL = 2
 } takes_argument_t;
@@ -2458,29 +2458,29 @@ static const struct {
   takes_argument_t takes_argument;
 } CMDLINE_ONLY_OPTIONS[] = {
   { "-f",                     ARGUMENT_NECESSARY },
-  { "--allow-missing-torrc",  TAKES_NO_ARGUMENT },
+  { "--allow-missing-torrc",  ARGUMENT_NONE },
   { "--defaults-torrc",       ARGUMENT_NECESSARY },
   { "--hash-password",        ARGUMENT_NECESSARY },
   { "--dump-config",          ARGUMENT_OPTIONAL },
-  { "--list-fingerprint",     TAKES_NO_ARGUMENT },
-  { "--keygen",               TAKES_NO_ARGUMENT },
+  { "--list-fingerprint",     ARGUMENT_NONE },
+  { "--keygen",               ARGUMENT_NONE },
   { "--key-expiration",       ARGUMENT_OPTIONAL },
-  { "--newpass",              TAKES_NO_ARGUMENT },
-  { "--no-passphrase",        TAKES_NO_ARGUMENT },
+  { "--newpass",              ARGUMENT_NONE },
+  { "--no-passphrase",        ARGUMENT_NONE },
   { "--passphrase-fd",        ARGUMENT_NECESSARY },
-  { "--verify-config",        TAKES_NO_ARGUMENT },
-  { "--ignore-missing-torrc", TAKES_NO_ARGUMENT },
-  { "--quiet",                TAKES_NO_ARGUMENT },
-  { "--hush",                 TAKES_NO_ARGUMENT },
-  { "--version",              TAKES_NO_ARGUMENT },
-  { "--list-modules",         TAKES_NO_ARGUMENT },
-  { "--library-versions",     TAKES_NO_ARGUMENT },
-  { "-h",                     TAKES_NO_ARGUMENT },
-  { "--help",                 TAKES_NO_ARGUMENT },
-  { "--list-torrc-options",   TAKES_NO_ARGUMENT },
-  { "--list-deprecated-options",TAKES_NO_ARGUMENT },
-  { "--nt-service",           TAKES_NO_ARGUMENT },
-  { "-nt-service",            TAKES_NO_ARGUMENT },
+  { "--verify-config",        ARGUMENT_NONE },
+  { "--ignore-missing-torrc", ARGUMENT_NONE },
+  { "--quiet",                ARGUMENT_NONE },
+  { "--hush",                 ARGUMENT_NONE },
+  { "--version",              ARGUMENT_NONE },
+  { "--list-modules",         ARGUMENT_NONE },
+  { "--library-versions",     ARGUMENT_NONE },
+  { "-h",                     ARGUMENT_NONE },
+  { "--help",                 ARGUMENT_NONE },
+  { "--list-torrc-options",   ARGUMENT_NONE },
+  { "--list-deprecated-options",ARGUMENT_NONE },
+  { "--nt-service",           ARGUMENT_NONE },
+  { "-nt-service",            ARGUMENT_NONE },
   { NULL, 0 },
 };
 
@@ -2552,7 +2552,7 @@ config_parse_commandline(int argc, char **argv, int ignore_errors,
     } else if (want_arg == ARGUMENT_OPTIONAL && is_last) {
       arg = tor_strdup("");
     } else {
-      arg = (want_arg != TAKES_NO_ARGUMENT) ? tor_strdup(argv[i+1]) :
+      arg = (want_arg != ARGUMENT_NONE) ? tor_strdup(argv[i+1]) :
                                               tor_strdup("");
     }
 





More information about the tor-commits mailing list