[or-cvs] Nth time is the charm on list manip.

Nick Mathewson nickm at seul.org
Wed Mar 3 01:37:56 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv6313/src/or

Modified Files:
	circuit.c 
Log Message:
Nth time is the charm on list manip.

Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- circuit.c	2 Mar 2004 18:08:07 -0000	1.146
+++ circuit.c	3 Mar 2004 01:37:54 -0000	1.147
@@ -65,14 +65,16 @@
     global_circuitlist = tmp;
   }
 
-  if(!global_circuitlist)
-    return;
-
-  for (tmp = global_circuitlist; tmp->next; tmp=tmp->next) {
-    while (tmp->next && tmp->next->marked_for_close) {
+  tmp = global_circuitlist;
+  while (tmp && tmp->next) {
+    if (tmp->next->marked_for_close) {
       m = tmp->next->next;
       circuit_free(tmp->next);
       tmp->next = m;
+      /* Need to check new tmp->next; don't advance tmp. */
+    } else {
+      /* Advance tmp. */
+      tmp = tmp->next;
     }
   }
 }
@@ -1266,7 +1268,7 @@
   assert(c);
   assert(c->magic == CIRCUIT_MAGIC);
 
-  return 0; /* XXX fix the rest of this. */
+  return;
 
   assert(c->n_addr);
   assert(c->n_port);



More information about the tor-commits mailing list