summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wiens <j.wiens@teles.com>2018-01-17 15:57:52 +0100
committerEric Haszlakiewicz <erh+git@nimenees.com>2018-03-04 22:37:53 -0500
commitd222b137585cf525db3a5f84ec450d151e05318e (patch)
tree7101fc8f482710f23f6104eee4bbacb0c280b1fa
parent4d814600d7ebe57c13263e0e1f9d8b0674d35eea (diff)
downloadjson-c-d222b137585cf525db3a5f84ec450d151e05318e.tar.gz
Avoid uninitialized variable warnings
Fix json_object_object_foreach to avoid uninitialized variable warnings using ANSI C or MSC.
-rw-r--r--json_object.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/json_object.h b/json_object.h
index 4b7a246..073d80c 100644
--- a/json_object.h
+++ b/json_object.h
@@ -529,8 +529,8 @@ JSON_EXPORT void json_object_object_del(struct json_object* obj, const char *key
#else /* ANSI C or MSC */
# define json_object_object_foreach(obj,key,val) \
- char *key;\
- struct json_object *val; \
+ char *key = NULL;\
+ struct json_object *val = NULL; \
struct lh_entry *entry ## key; \
struct lh_entry *entry_next ## key = NULL; \
for(entry ## key = json_object_get_object(obj)->head; \