diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-04-03 06:23:24 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-04-03 06:23:24 +0000 |
commit | eba6204315eb8ae21ace848cbc2f4abf765386be (patch) | |
tree | d10e0fca5d9de53dd57bc654543c479eaeeb149f /src/or/routerparse.c | |
parent | 2cb3aeb4e1f4464c126df0911cf4408e6bc29f57 (diff) | |
download | tor-eba6204315eb8ae21ace848cbc2f4abf765386be.tar.gz tor-eba6204315eb8ae21ace848cbc2f4abf765386be.zip |
fix some xxxs.
svn:r6307
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 1ee0594a73..48a5aa7efb 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--); + } + } } |