Go to the documentation of this file.
11 #ifndef TOR_SMARTLIST_FOREACH_H
12 #define TOR_SMARTLIST_FOREACH_H
78 #define SMARTLIST_FOREACH_BEGIN(sl, type, var) \
80 int var ## _sl_idx, var ## _sl_len=(sl)->num_used; \
82 for (var ## _sl_idx = 0; var ## _sl_idx < var ## _sl_len; \
84 var = (sl)->list[var ## _sl_idx];
91 #define SMARTLIST_FOREACH_REVERSE_BEGIN(sl, type, var) \
93 int var ## _sl_idx, var ## _sl_len=(sl)->num_used; \
95 for (var ## _sl_idx = var ## _sl_len-1; var ## _sl_idx >= 0; \
97 var = (sl)->list[var ## _sl_idx];
99 #define SMARTLIST_FOREACH_END(var) \
101 (void) var ## _sl_idx; \
112 #define SMARTLIST_FOREACH(sl, type, var, cmd) \
113 SMARTLIST_FOREACH_BEGIN(sl,type,var) { \
115 } SMARTLIST_FOREACH_END(var)
120 #define SMARTLIST_DEL_CURRENT(sl, var) \
122 smartlist_del(sl, var ## _sl_idx); \
130 #define SMARTLIST_DEL_CURRENT_KEEPORDER(sl, var) \
132 smartlist_del_keeporder(sl, var ## _sl_idx); \
141 #define SMARTLIST_REPLACE_CURRENT(sl, var, val) \
143 smartlist_set(sl, var ## _sl_idx, val); \