Add json_array_foreach() #define, parallelling json_object_foreach()

This commit is contained in:
Daniel Griscom 2013-05-12 15:03:26 -04:00
parent d3bd463897
commit 6950cd203b

View file

@ -148,6 +148,11 @@ int json_object_iter_set_new(json_t *object, void *iter, json_t *value);
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
#define json_array_foreach(array, index, value) \
for(index = 0; \
index < json_array_size(array) && (value = json_array_get(array, index)); \
index++)
static JSON_INLINE
int json_object_set(json_t *object, const char *key, json_t *value)
{