aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-10-18 05:03:44 +0000
committerNick Mathewson <nickm@torproject.org>2005-10-18 05:03:44 +0000
commitcf73ff195bc3e2d64f44c5bded9cff5cdd53797e (patch)
tree8bc0b0507bc78fcc5a353ecd9f3eba93e58c687b /src/common
parent768160c872da938d14b441fceef25de1d473df58 (diff)
downloadtor-cf73ff195bc3e2d64f44c5bded9cff5cdd53797e.tar
tor-cf73ff195bc3e2d64f44c5bded9cff5cdd53797e.tar.gz
Actually, use #defines for common case. Nothing to see here.
svn:r5266
Diffstat (limited to 'src/common')
-rw-r--r--src/common/container.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/common/container.h b/src/common/container.h
index 7a8ef78ad..b36e85b2d 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -37,32 +37,33 @@ int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2);
void smartlist_intersect(smartlist_t *sl1, const smartlist_t *sl2);
void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2);
/* smartlist_choose() is defined in crypto.[ch] */
+#ifdef DEBUG_SMARTLIST
/** Return the number of items in sl.
*/
extern INLINE int smartlist_len(const smartlist_t *sl) {
-#ifdef DEBUG_SMARTLIST
tor_assert(sl);
-#endif
return (sl)->num_used;
}
/** Return the <b>idx</b>th element of sl.
*/
extern INLINE void *smartlist_get(const smartlist_t *sl, int idx) {
-#ifdef DEBUG_SMARTLIST
tor_assert(sl);
tor_assert(idx>=0);
tor_assert(sl->num_used < idx);
-#endif
return sl->list[idx];
}
extern INLINE void smartlist_set(smartlist_t *sl, int idx, void *val) {
-#ifdef DEBUG_SMARTLIST
tor_assert(sl);
tor_assert(idx>=0);
tor_assert(sl->num_used < idx);
-#endif
sl->list[idx] = val;
}
+#else
+#define smartlist_len(sl) ((sl)->num_used)
+#define smartlist_get(sl, idx) ((sl)->list[idx])
+#define smartlist_set(sl, idx, val) ((sl)->list[idx] = (val))
+#endif
+
void smartlist_del(smartlist_t *sl, int idx);
void smartlist_del_keeporder(smartlist_t *sl, int idx);
void smartlist_insert(smartlist_t *sl, int idx, void *val);