[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] stop the call duplication inside config_assign()
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
config.c
Log Message:
stop the call duplication inside config_assign()
Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.418
retrieving revision 1.419
diff -u -d -r1.418 -r1.419
--- config.c 14 Sep 2005 02:18:28 -0000 1.418
+++ config.c 14 Sep 2005 02:35:06 -0000 1.419
@@ -873,7 +873,7 @@
*/
static int
config_assign_line(config_format_t *fmt, or_options_t *options,
- config_line_t *c, int use_defaults)
+ config_line_t *c, int use_defaults, int clear_first)
{
config_var_t *var;
@@ -891,7 +891,8 @@
}
if (!strlen(c->value)) { /* reset or clear it, then return */
- option_reset(fmt, options, var, use_defaults);
+ if (!clear_first) /* not already cleared */
+ option_reset(fmt, options, var, use_defaults);
return 0;
}
@@ -1077,7 +1078,7 @@
Case one: Torrc entry
options_init_from_torrc() calls config_assign(0, 0)
- calls config_assign_line(0).
+ calls config_assign_line(0, 0).
if value is empty, calls option_reset(0) and returns.
calls config_assign_value(), appends.
@@ -1086,8 +1087,8 @@
calls config_reset_line(0)
calls option_reset(0)
calls option_clear().
- calls config_assign_line(0).
- if value is empty, calls option_reset(0) and returns.
+ calls config_assign_line(0, 1).
+ if value is empty, returns.
calls config_assign_value(), appends.
Case three: resetconf
@@ -1096,8 +1097,8 @@
calls option_reset(1)
calls option_clear().
calls config_assign_value(default)
- calls config_assign_line(1).
- calls option_reset(1) and returns.
+ calls config_assign_line(1, 1).
+ returns.
*/
static int
config_assign(config_format_t *fmt, void *options,
@@ -1126,7 +1127,7 @@
/* pass 3: assign. */
while (list) {
int r;
- if ((r=config_assign_line(fmt, options, list, use_defaults)))
+ if ((r=config_assign_line(fmt, options, list, use_defaults, clear_first)))
return r;
list = list->next;
}