Use json_is_true() in place of json_boolean_value() for compatibility
[trust_router.git] / common / jansson_iterators.h
1 /*
2  * Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
3  *
4  * Jansson is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7 /*See the LICENSE file in the jansson source distribution.
8  */
9
10 #ifndef json_object_foreach
11 #define json_object_foreach(object, key, value) \
12     for(key = json_object_iter_key(json_object_iter(object)); \
13         key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
14         key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
15 #endif
16
17 #ifndef json_array_foreach
18 #define json_array_foreach(array, index, value) \
19         for(index = 0; \
20                 index < json_array_size(array) && (value = json_array_get(array, index)); \
21                 index++)
22 #endif