[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] change the interface to config_trial_assign()



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

Modified Files:
	config.c control.c or.h 
Log Message:
change the interface to config_trial_assign()


Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -d -r1.231 -r1.232
--- config.c	9 Nov 2004 07:45:24 -0000	1.231
+++ config.c	9 Nov 2004 07:55:48 -0000	1.232
@@ -681,10 +681,10 @@
  * keys, -2 on bad values, -3 on bad transition.
  */
 int
-config_trial_assign(or_options_t **options, struct config_line_t *list, int reset)
+config_trial_assign(or_options_t *options, struct config_line_t *list, int reset)
 {
   int r;
-  or_options_t *trial_options = options_dup(*options);
+  or_options_t *trial_options = options_dup(options);
 
   if ((r=config_assign(trial_options, list, reset)) < 0) {
     options_free(trial_options);
@@ -696,12 +696,12 @@
     return -2;
   }
 
-  if (options_transition_allowed(*options, trial_options) < 0) {
+  if (options_transition_allowed(options, trial_options) < 0) {
     options_free(trial_options);
     return -3;
   }
 
-  *options = trial_options;
+  set_options(trial_options); /* we liked it. put it in place. */
   return 0;
 }
 

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/src/or/control.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- control.c	9 Nov 2004 07:05:53 -0000	1.17
+++ control.c	9 Nov 2004 07:55:48 -0000	1.18
@@ -202,7 +202,6 @@
 {
   int r;
   struct config_line_t *lines=NULL;
-  or_options_t *options = get_options();
 
   if (config_get_lines(body, &lines) < 0) {
     log_fn(LOG_WARN,"Controller gave us config lines we can't parse.");
@@ -210,7 +209,7 @@
     return 0;
   }
 
-  if ((r=config_trial_assign(&options, lines, 1)) < 0) {
+  if ((r=config_trial_assign(get_options(), lines, 1)) < 0) {
     log_fn(LOG_WARN,"Controller gave us config lines that didn't validate.");
     if (r==-1) {
       send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY,
@@ -223,7 +222,6 @@
   }
 
   config_free_lines(lines);
-  set_options(options); /* put the new one into place */
   if (options_act() < 0) { /* acting on them failed. die. */
     log_fn(LOG_ERR,"Acting on config options left us in a broken state. Dying.");
     exit(1);

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.469
retrieving revision 1.470
diff -u -d -r1.469 -r1.470
--- or.h	9 Nov 2004 07:05:53 -0000	1.469
+++ or.h	9 Nov 2004 07:55:48 -0000	1.470
@@ -1097,7 +1097,7 @@
 
 int config_get_lines(char *string, struct config_line_t **result);
 void config_free_lines(struct config_line_t *front);
-int config_trial_assign(or_options_t **options, struct config_line_t *list, int reset);
+int config_trial_assign(or_options_t *options, struct config_line_t *list, int reset);
 int resolve_my_address(const char *address, uint32_t *addr);
 void options_init(or_options_t *options);
 int init_from_config(int argc, char **argv);