diff options
author | Peter Palfrader <peter@palfrader.org> | 2007-07-02 17:48:56 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2007-07-02 17:48:56 +0000 |
commit | adff891463aa24b831ddd20c08068cf617007a65 (patch) | |
tree | ee8780662c9b52864c8748532462437ac75820b8 | |
parent | ea1348360ea2c03e29cadace9af620cfec7c36a9 (diff) | |
download | tor-adff891463aa24b831ddd20c08068cf617007a65.tar.gz tor-adff891463aa24b831ddd20c08068cf617007a65.zip |
Make DEBUG_SMARTLIST work
svn:r10721
-rw-r--r-- | src/common/container.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/container.h b/src/common/container.h index 973bc38640..ac213af212 100644 --- a/src/common/container.h +++ b/src/common/container.h @@ -55,22 +55,24 @@ void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2); #ifdef DEBUG_SMARTLIST /** Return the number of items in sl. */ -extern INLINE int smartlist_len(const smartlist_t *sl) ATTR_PURE { +extern INLINE int smartlist_len(const smartlist_t *sl) ATTR_PURE; +extern INLINE int smartlist_len(const smartlist_t *sl) { tor_assert(sl); return (sl)->num_used; } /** Return the <b>idx</b>th element of sl. */ -extern INLINE void *smartlist_get(const smartlist_t *sl, int idx) ATTR_PURE { +extern INLINE void *smartlist_get(const smartlist_t *sl, int idx) ATTR_PURE; +extern INLINE void *smartlist_get(const smartlist_t *sl, int idx) { tor_assert(sl); tor_assert(idx>=0); - tor_assert(sl->num_used < idx); + tor_assert(sl->num_used > idx); return sl->list[idx]; } extern INLINE void smartlist_set(smartlist_t *sl, int idx, void *val) { tor_assert(sl); tor_assert(idx>=0); - tor_assert(sl->num_used < idx); + tor_assert(sl->num_used > idx); sl->list[idx] = val; } #else |