diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-03-11 21:42:32 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-03-11 21:42:32 +0000 |
commit | 2b7907ef42d6b4004dd0b0ebc4d4df7cda13ffc6 (patch) | |
tree | 626aa958ac0862ed783bfb52f5218f625fdb8406 /src/or/connection_edge.c | |
parent | 777d3dde0c828a67d52419feb5a8d0587d63dbc1 (diff) | |
download | tor-2b7907ef42d6b4004dd0b0ebc4d4df7cda13ffc6.tar.gz tor-2b7907ef42d6b4004dd0b0ebc4d4df7cda13ffc6.zip |
Increment step of a for loop should only happen once.
svn:r3746
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 420047e826..4e8b15a116 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -718,24 +718,22 @@ addressmap_get_mappings(smartlist_t *sl, time_t min_expires, time_t max_expires) void *_val; addressmap_entry_t *val; - for (iter = strmap_iter_init(addressmap); !strmap_iter_done(iter); - iter = strmap_iter_next(addressmap,iter)) { + for (iter = strmap_iter_init(addressmap); !strmap_iter_done(iter); ) { strmap_iter_get(iter, &key, &_val); val = _val; if (val->expires >= min_expires && val->expires <= max_expires) { - if (sl) { + if (!sl) { + addressmap_ent_remove(key, val); + iter = strmap_iter_next_rmv(addressmap,iter); + continue; + } else { size_t len = strlen(key)+strlen(val->new_address)+2; char *line = tor_malloc(len); tor_snprintf(line, len, "%s %s", key, val->new_address); smartlist_add(sl, line); - iter = strmap_iter_next(addressmap,iter); - } else { - addressmap_ent_remove(key, val); - iter = strmap_iter_next_rmv(addressmap,iter); } - } else { - iter = strmap_iter_next(addressmap,iter); } + iter = strmap_iter_next(addressmap,iter); } } |