[or-cvs] fix some dereferences

Roger Dingledine arma at seul.org
Tue Nov 9 05:59:24 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	config.c 
Log Message:
fix some dereferences


Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -d -r1.222 -r1.223
--- config.c	9 Nov 2004 05:35:49 -0000	1.222
+++ config.c	9 Nov 2004 05:59:22 -0000	1.223
@@ -583,7 +583,7 @@
   switch(var->type)
     {
     case CONFIG_TYPE_STRING:
-      result->value = tor_strdup(value ? (char*)value : "");
+      result->value = tor_strdup(*(char**)value ? *(char**)value : "");
       break;
     case CONFIG_TYPE_UINT:
       /* XXX This means every or_options_t uint or bool element
@@ -599,8 +599,8 @@
       result->value = tor_strdup(*(int*)value ? "1" : "0");
       break;
     case CONFIG_TYPE_CSV:
-      if (value)
-        result->value = smartlist_join_strings((smartlist_t*)value,",",0,NULL);
+      if (*(smartlist_t**)value)
+        result->value = smartlist_join_strings(*(smartlist_t**)value,",",0,NULL);
       else
         result->value = tor_strdup("");
       break;
@@ -909,15 +909,15 @@
 static or_options_t *
 options_dup(or_options_t *old)
 {
-  or_options_t *new;
+  or_options_t *newopts;
   int i;
   struct config_line_t *line;
 
-  new = tor_malloc_zero(sizeof(or_options_t));
+  newopts = tor_malloc_zero(sizeof(or_options_t));
   for (i=0; config_vars[i].name; ++i) {
     line = config_get_assigned_option(old, config_vars[i].name);
     if (line) {
-      if (config_assign(new, line, 0) < 0) {
+      if (config_assign(newopts, line, 0) < 0) {
         log_fn(LOG_WARN,"Bug: config_get_assigned_option() generated "
                "something we couldn't config_assign().");
         tor_assert(0);
@@ -925,7 +925,7 @@
     }
     config_free_lines(line);
   }
-  return new;
+  return newopts;
 }
 
 /** Set <b>options</b> to hold reasonable defaults for most options.



More information about the tor-commits mailing list