summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-06 21:19:59 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-06 21:19:59 +0000
commit8b371c2aa536c30926bcf48e1ff2a756e139a08d (patch)
treeb33b19f97f8e1d897e0b48df797a2009ab921ad6 /src/common/util.c
parent2fc106d2101edd80a7ba8cdcc9f49522619ba9cf (diff)
downloadtor-8b371c2aa536c30926bcf48e1ff2a756e139a08d.tar.gz
tor-8b371c2aa536c30926bcf48e1ff2a756e139a08d.zip
router_choose_random_node wants a smartlist of routers, not of nicknames.
svn:r1510
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 6ba9260865..6df6853aba 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -208,6 +208,11 @@ void smartlist_set_capacity(smartlist_t *sl, int n) {
}
}
+/* 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) {