From: Jonathan Wiens Date: Wed, 17 Jan 2018 14:57:52 +0000 (+0100) Subject: Avoid uninitialized variable warnings X-Git-Tag: json-c-0.13.1-20180305~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d222b137585cf525db3a5f84ec450d151e05318e;p=thirdparty%2Fjson-c.git Avoid uninitialized variable warnings Fix json_object_object_foreach to avoid uninitialized variable warnings using ANSI C or MSC. --- diff --git a/json_object.h b/json_object.h index 4b7a2461..073d80c6 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; \