diff options
author | Anony Moose <noMail@nomail.su> | 2013-08-26 20:16:09 +0000 |
---|---|---|
committer | Anony Moose <noMail@nomail.su> | 2013-08-26 20:16:09 +0000 |
commit | 79f759049bc2dca33e669061dca098e519adfcb7 (patch) | |
tree | 1505038ef0efe44d081b98e6c3bfc926b4a03703 /testing/misc_tools.h | |
parent | 60bf9991b4f307478135a0b2a696c49a69246987 (diff) |
Trying to fix memory leak.
Diffstat (limited to 'testing/misc_tools.h')
-rw-r--r-- | testing/misc_tools.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/testing/misc_tools.h b/testing/misc_tools.h index 3b71d8c4..272cca19 100644 --- a/testing/misc_tools.h +++ b/testing/misc_tools.h | |||
@@ -161,19 +161,9 @@ static inline void tox_array_pop(tox_array *arr, uint32_t num) | |||
161 | arr->data = realloc(arr->data, arr->elem_size*arr->len); | 161 | arr->data = realloc(arr->data, arr->elem_size*arr->len); |
162 | } | 162 | } |
163 | 163 | ||
164 | /* TODO: do not use type, since we track the needed info in | 164 | /* TODO: return ptr and do not take type */ |
165 | * elem_size (but array user will have to cast) | ||
166 | */ | ||
167 | #define tox_array_get(arr, i, type) (((type*)(arr)->data)[i]) | 165 | #define tox_array_get(arr, i, type) (((type*)(arr)->data)[i]) |
168 | 166 | ||
169 | /* This version requires C99 (declaring variables inside for loop) | ||
170 | #define tox_array_for_each(arr, type, tmp_name) \ | ||
171 | for ( \ | ||
172 | struct { type val; uint32_t i; } tmp_name = { tox_array_get(arr, 0, type), 0 }; \ | ||
173 | tmp_name.i != (arr)->len; \ | ||
174 | tmp_name.val = tox_array_get(arr, ++tmp_name.i, type) \ | ||
175 | ) | ||
176 | */ | ||
177 | 167 | ||
178 | #define tox_array_for_each(arr, type, tmp_name) \ | 168 | #define tox_array_for_each(arr, type, tmp_name) \ |
179 | type tmp_name; uint32_t tmp_name ## _i = 0; \ | 169 | type tmp_name; uint32_t tmp_name ## _i = 0; \ |