Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison array.h @ 9:1fbcbd58742e
move destroyall to array.h
author | David A. Holland |
---|---|
date | Sun, 19 Dec 2010 19:19:02 -0500 |
parents | 0601b6e8e53d |
children | b156910b59b2 |
comparison
equal
deleted
inserted
replaced
8:97243badae69 | 9:1fbcbd58742e |
---|---|
225 } | 225 } |
226 | 226 |
227 #define DECLARRAY(T) DECLARRAY_BYTYPE(T##array, struct T) | 227 #define DECLARRAY(T) DECLARRAY_BYTYPE(T##array, struct T) |
228 #define DEFARRAY(T, INLINE) DEFARRAY_BYTYPE(T##array, struct T, INLINE) | 228 #define DEFARRAY(T, INLINE) DEFARRAY_BYTYPE(T##array, struct T, INLINE) |
229 | 229 |
230 #define DESTROYALL_ARRAY(T, INLINE) \ | |
231 void T##array_destroyall(struct T##array *arr); \ | |
232 \ | |
233 INLINE void \ | |
234 T##array_destroyall(struct T##array *arr) \ | |
235 { \ | |
236 unsigned i, num; \ | |
237 struct T *t; \ | |
238 \ | |
239 num = T##array_num(arr); \ | |
240 for (i=0; i<num; i++) { \ | |
241 t = T##array_get(arr, i); \ | |
242 T##_destroy(t); \ | |
243 } \ | |
244 T##array_setsize(arr, 0); \ | |
245 } | |
246 | |
247 | |
230 //////////////////////////////////////////////////////////// | 248 //////////////////////////////////////////////////////////// |
231 // basic array types | 249 // basic array types |
232 | 250 |
233 DECLARRAY_BYTYPE(stringarray, char); | 251 DECLARRAY_BYTYPE(stringarray, char); |
234 DEFARRAY_BYTYPE(stringarray, char, ARRAYINLINE); | 252 DEFARRAY_BYTYPE(stringarray, char, ARRAYINLINE); |