aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-04-03 06:23:24 +0000
committerNick Mathewson <nickm@torproject.org>2006-04-03 06:23:24 +0000
commiteba6204315eb8ae21ace848cbc2f4abf765386be (patch)
treed10e0fca5d9de53dd57bc654543c479eaeeb149f /src/or/routerparse.c
parent2cb3aeb4e1f4464c126df0911cf4408e6bc29f57 (diff)
downloadtor-eba6204315eb8ae21ace848cbc2f4abf765386be.tar
tor-eba6204315eb8ae21ace848cbc2f4abf765386be.tar.gz
fix some xxxs.
svn:r6307
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 1ee0594a7..48a5aa7ef 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1926,8 +1926,24 @@ _compare_tor_version_str_ptr(const void **_a, const void **_b)
/** Sort a list of string-representations of versions in ascending order. */
void
-sort_version_list(smartlist_t *versions)
+sort_version_list(smartlist_t *versions, int remove_duplicates)
{
+ int i;
+
smartlist_sort(versions, _compare_tor_version_str_ptr);
+ if (!remove_duplicates)
+ return;
+
+ for (i = 1; i < smartlist_len(versions); ++i) {
+ void *a, *b;
+ a = smartlist_get(versions, i-1);
+ b = smartlist_get(versions, i);
+ /* use version_cmp so we catch multiple representations of the same
+ * version */
+ if (_compare_tor_version_str_ptr(a,b) == 0) {
+ tor_free(smartlist_get(versions, i));
+ smartlist_del(versions, i--);
+ }
+ }
}