diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-11-12 00:03:33 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-11-12 00:03:33 +0000 | 
| commit | 67ebc8e0063e18f88752da04e9576330193e2e13 (patch) | |
| tree | 7de02acbb26b59e77a576a389e149efc4cfab834 | |
| parent | e132b60e77f395463cf95dc4ee09e96e9658ae35 (diff) | |
Fixed valgrind warnings in JSON_O_FOREACH.
| -rw-r--r-- | lib/json_util.h | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/lib/json_util.h b/lib/json_util.h index fa4510bb..e0f1f7b8 100644 --- a/lib/json_util.h +++ b/lib/json_util.h @@ -25,9 +25,10 @@  #define JSON_O_FOREACH(o, k, v) \  	char *k; json_value *v; int __i; \ -	for( __i = 0; k = (o)->u.object.values[__i].name, \ -	              v = (o)->u.object.values[__i].value, \ -	              __i < (o)->u.object.length; __i ++ ) +	for( __i = 0; ( __i < (o)->u.object.length ) && \ +	              ( k = (o)->u.object.values[__i].name ) && \ +	              ( v = (o)->u.object.values[__i].value ); \ +	              __i ++ )  json_value *json_o_get( const json_value *obj, const json_char *name );  const char *json_o_str( const json_value *obj, const json_char *name ); | 
