diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-09-01 02:00:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-10-15 15:17:13 -0400 |
commit | a8e92ba8fd65e12dbec265ccfcf0c89ac61847f2 (patch) | |
tree | b8a53aca97fda17e44cf74035f8b733a1cf87839 /src/common/container.h | |
parent | a7ba02f3f1dc267be81bf36f16bc1e69b34af050 (diff) | |
download | tor-a8e92ba8fd65e12dbec265ccfcf0c89ac61847f2.tar.gz tor-a8e92ba8fd65e12dbec265ccfcf0c89ac61847f2.zip |
Add a function to get the most frequent member of a list.
Diffstat (limited to 'src/common/container.h')
-rw-r--r-- | src/common/container.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/container.h b/src/common/container.h index 4495a7a273..41c0c68705 100644 --- a/src/common/container.h +++ b/src/common/container.h @@ -93,13 +93,22 @@ void smartlist_del_keeporder(smartlist_t *sl, int idx); void smartlist_insert(smartlist_t *sl, int idx, void *val); void smartlist_sort(smartlist_t *sl, int (*compare)(const void **a, const void **b)); +void *smartlist_get_most_frequent(const smartlist_t *sl, + int (*compare)(const void **a, const void **b)); void smartlist_uniq(smartlist_t *sl, int (*compare)(const void **a, const void **b), void (*free_fn)(void *elt)); + void smartlist_sort_strings(smartlist_t *sl); void smartlist_sort_digests(smartlist_t *sl); +void smartlist_sort_digests256(smartlist_t *sl); + +char *smartlist_get_most_frequent_string(smartlist_t *sl); +char *smartlist_get_most_frequent_digest256(smartlist_t *sl); + void smartlist_uniq_strings(smartlist_t *sl); void smartlist_uniq_digests(smartlist_t *sl); +void smartlist_uniq_digests256(smartlist_t *sl); void *smartlist_bsearch(smartlist_t *sl, const void *key, int (*compare)(const void *key, const void **member)) ATTR_PURE; |