From 0da343068e64107139360a6990e69ca07997df8f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 16 Sep 2015 21:28:01 +0800 Subject: [PATCH] add new macro for iterating over an array --- cJSON.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cJSON.h b/cJSON.h index 466d10d..5fe2027 100644 --- a/cJSON.h +++ b/cJSON.h @@ -142,6 +142,9 @@ extern void cJSON_Minify(char *json); #define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val)) #define cJSON_SetNumberValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val)) +/* Macro for iterating over an array */ +#define cJSON_ArrayForEach(pos, head) for(pos = (head)->child; pos != NULL; pos = pos->next) + #ifdef __cplusplus } #endif