[or-cvs] r15305: Clean up a macro/cpp interaction related to bug 707. Also, a (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Mon Jun 16 18:09:53 UTC 2008


Author: nickm
Date: 2008-06-16 14:09:53 -0400 (Mon, 16 Jun 2008)
New Revision: 15305

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
Log:
Clean up a macro/cpp interaction related to bug 707.  Also, add a new "filename" config value type which is currently just a synonym for string, but which might be subject to expansion later.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-06-16 17:47:55 UTC (rev 15304)
+++ tor/trunk/ChangeLog	2008-06-16 18:09:53 UTC (rev 15305)
@@ -15,6 +15,7 @@
   o Bugfixes:
     - Asking for a conditional consensus at .../consensus/<fingerprints>
       would crash a dirserver if it did not already have a consensus.
+    - Clean up some macro/cpp interactions.
 
 Changes in version 0.2.1.1-alpha - 2008-06-13
   o Major features:

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2008-06-16 17:47:55 UTC (rev 15304)
+++ tor/trunk/src/or/config.c	2008-06-16 18:09:53 UTC (rev 15305)
@@ -22,6 +22,7 @@
 /** Enumeration of types which option values can take */
 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_INTERVAL,     /**< A number of seconds, with optional units*/
   CONFIG_TYPE_MEMUNIT,      /**< A number of bytes, with optional units*/
@@ -171,7 +172,7 @@
   V(CookieAuthentication,        BOOL,     "0"),
   V(CookieAuthFileGroupReadable, BOOL,     "0"),
   V(CookieAuthFile,              STRING,   NULL),
-  V(DataDirectory,               STRING,   NULL),
+  V(DataDirectory,               FILENAME, NULL),
   OBSOLETE("DebugLogFile"),
   V(DirAllowPrivateAddresses,    BOOL,     NULL),
   V(DirTimeToLearnReachability,  INTERVAL, "30 minutes"),
@@ -194,7 +195,7 @@
   V(ExitNodes,                   STRING,   NULL),
   V(ExitPolicy,                  LINELIST, NULL),
   V(ExitPolicyRejectPrivate,     BOOL,     "1"),
-  V(FallbackNetworkstatusFile,   STRING,
+  V(FallbackNetworkstatusFile,   FILENAME,
     SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "fallback-consensus"),
   V(FascistFirewall,             BOOL,     "0"),
   V(FirewallPorts,               CSV,      ""),
@@ -203,13 +204,12 @@
   V(FetchServerDescriptors,      BOOL,     "1"),
   V(FetchHidServDescriptors,     BOOL,     "1"),
   V(FetchUselessDescriptors,     BOOL,     "0"),
-  V(GeoIPFile,                   STRING,
 #ifdef WIN32
-    "<default>"
+  V(GeoIPFile,                   FILENAME, "<default>"),
 #else
-    SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"
+  V(GeoIPFile,                   FILENAME,
+    SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),
 #endif
-),
   V(Group,                       STRING,   NULL),
   V(HardwareAccel,               BOOL,     "0"),
   V(HashedControlPassword,       LINELIST, NULL),
@@ -1626,6 +1626,7 @@
     break;
 
   case CONFIG_TYPE_STRING:
+  case CONFIG_TYPE_FILENAME:
     tor_free(*(char **)lvalue);
     *(char **)lvalue = tor_strdup(c->value);
     break;
@@ -1850,6 +1851,7 @@
   switch (var->type)
     {
     case CONFIG_TYPE_STRING:
+    case CONFIG_TYPE_FILENAME:
       if (*(char**)value) {
         result->value = tor_strdup(*(char**)value);
       } else {
@@ -2080,6 +2082,7 @@
   (void)fmt; /* unused */
   switch (var->type) {
     case CONFIG_TYPE_STRING:
+    case CONFIG_TYPE_FILENAME:
       tor_free(*(char**)lvalue);
       break;
     case CONFIG_TYPE_DOUBLE:
@@ -5107,6 +5110,7 @@
       desc = config_find_description(&options_format, var->name);
       switch (var->type) {
         case CONFIG_TYPE_STRING: type = "String"; break;
+        case CONFIG_TYPE_FILENAME: type = "Filename"; break;
         case CONFIG_TYPE_UINT: type = "Integer"; break;
         case CONFIG_TYPE_INTERVAL: type = "TimeInterval"; break;
         case CONFIG_TYPE_MEMUNIT: type = "DataSize"; break;



More information about the tor-commits mailing list