[or-cvs] router_choose_random_node wants a smartlist of routers, not...

Nick Mathewson nickm at seul.org
Tue Apr 6 21:20:01 UTC 2004


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

Modified Files:
	util.c util.h 
Log Message:
router_choose_random_node wants a smartlist of routers, not of nicknames.

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- util.c	6 Apr 2004 20:16:11 -0000	1.80
+++ util.c	6 Apr 2004 21:19:59 -0000	1.81
@@ -208,6 +208,11 @@
   }
 }
 
+/* Remove all elements from the list. */
+void smartlist_clear(smartlist_t *sl) {
+  sl->num_used = 0;
+}
+
 /* add element to the list, but only if there's room */
 void smartlist_add(smartlist_t *sl, void *element) {
   if (sl->num_used >= sl->capacity) {

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- util.h	6 Apr 2004 20:16:11 -0000	1.52
+++ util.h	6 Apr 2004 21:19:59 -0000	1.53
@@ -102,6 +102,7 @@
 smartlist_t *smartlist_create();
 void smartlist_free(smartlist_t *sl);
 void smartlist_set_capacity(smartlist_t *sl, int n);
+void smartlist_clear(smartlist_t *sl);
 void smartlist_add(smartlist_t *sl, void *element);
 void smartlist_remove(smartlist_t *sl, void *element);
 int smartlist_isin(smartlist_t *sl, void *element);



More information about the tor-commits mailing list