diff options
author | Roger Dingledine <arma@torproject.org> | 2005-09-14 02:35:06 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-09-14 02:35:06 +0000 |
commit | 93be26a74a843e0aa671f04f0f62b2b3590f6e11 (patch) | |
tree | 5da494523960a333848b03bd91160e526e9c2503 /src | |
parent | 6aa8850d9031c29fac3457f6ed70200932437b2d (diff) | |
download | tor-93be26a74a843e0aa671f04f0f62b2b3590f6e11.tar.gz tor-93be26a74a843e0aa671f04f0f62b2b3590f6e11.zip |
stop the call duplication inside config_assign()
svn:r5045
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/or/config.c b/src/or/config.c index f29c4ca0bc..d8ad80fc43 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -873,7 +873,7 @@ config_assign_value(config_format_t *fmt, or_options_t *options, */ 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 @@ config_assign_line(config_format_t *fmt, or_options_t *options, } 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 @@ There are three call cases for config_assign() currently. 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 @@ options_trial_assign() calls config_assign(0, 1) 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 @@ options_trial_assign() calls config_assign(1, 1) 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 @@ config_assign(config_format_t *fmt, void *options, /* 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; } |