[utils] Adding index to cstring_array_foreach, similar to Python's enumerate

This commit is contained in:
Al
2015-09-04 19:34:00 -04:00
parent df20e2cbc0
commit ec3ab7234a

View File

@@ -162,8 +162,9 @@ int64_t cstring_array_token_length(cstring_array *self, uint32_t i);
void cstring_array_destroy(cstring_array *self);
#define cstring_array_foreach(array, s, code) { \
#define cstring_array_foreach(array, i, s, code) { \
for (int __si = 0; __si < array->indices->n; __si++) { \
(i) = __si; \
(s) = array->str->a + array->indices->a[__si]; \
code; \
} \