[or-cvs] Increment step of a for loop should only happen once.
Nick Mathewson
nickm at seul.org
Fri Mar 11 21:42:34 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv14747/src/or
Modified Files:
connection_edge.c
Log Message:
Increment step of a for loop should only happen once.
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -d -r1.294 -r1.295
--- connection_edge.c 11 Mar 2005 21:39:39 -0000 1.294
+++ connection_edge.c 11 Mar 2005 21:42:32 -0000 1.295
@@ -718,24 +718,22 @@
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);
}
}
More information about the tor-commits
mailing list