From a8f9ba91db3d326b9b6ff67c35e7b52ae11d08c4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Nov 2004 21:14:06 +0000 Subject: Nobody was using the return values from smartlist_(set|del|del_keeporder), so remove them. svn:r2823 --- src/common/container.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'src/common/container.c') diff --git a/src/common/container.c b/src/common/container.c index df20eca6a..ec47adf72 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -172,57 +172,47 @@ void *smartlist_get(const smartlist_t *sl, int idx) tor_assert(idx < sl->num_used); return sl->list[idx]; } -/** Return the number of items in sl. - */ -int smartlist_len(const smartlist_t *sl) -{ - return sl->num_used; -} -#endif - /** Change the value of the idxth element of sl to val; return the old * value of the idxth element. */ -void *smartlist_set(smartlist_t *sl, int idx, void *val) +void smartlist_set(smartlist_t *sl, int idx, void *val) { - void *old; tor_assert(sl); tor_assert(idx>=0); tor_assert(idx < sl->num_used); - old = sl->list[idx]; sl->list[idx] = val; - return old; } +/** Return the number of items in sl. + */ +int smartlist_len(const smartlist_t *sl) +{ + return sl->num_used; +} +#endif /** Remove the idxth element of sl; if idx is not the last * element, swap the last element of sl into the idxth space. * Return the old value of the idxth element. */ -void *smartlist_del(smartlist_t *sl, int idx) +void smartlist_del(smartlist_t *sl, int idx) { - void *old; tor_assert(sl); tor_assert(idx>=0); tor_assert(idx < sl->num_used); - old = sl->list[idx]; sl->list[idx] = sl->list[--sl->num_used]; - return old; } /** Remove the idxth element of sl; if idx is not the last element, * moving all subsequent elements back one space. Return the old value * of the idxth element. */ -void *smartlist_del_keeporder(smartlist_t *sl, int idx) +void smartlist_del_keeporder(smartlist_t *sl, int idx) { - void *old; tor_assert(sl); tor_assert(idx>=0); tor_assert(idx < sl->num_used); - old = sl->list[idx]; --sl->num_used; if (idx < sl->num_used) memmove(sl->list+idx, sl->list+idx+1, sizeof(void*)*(sl->num_used-idx)); - return old; } /** Insert the value val as the new idxth element of * sl, moving all items previously at idx or later -- cgit v1.2.3