From: Stuart Walsh Date: Tue, 31 Mar 2015 11:23:03 +0000 (+0100) Subject: Fix uninitialised variable compile warning, and also fix unused-when-used warning X-Git-Tag: json-c-0.13-20171207~188^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F183%2Fhead;p=thirdparty%2Fjson-c.git Fix uninitialised variable compile warning, and also fix unused-when-used warning --- diff --git a/json_object.h b/json_object.h index 2bdfd5f9..a2011f71 100644 --- a/json_object.h +++ b/json_object.h @@ -344,8 +344,8 @@ extern void json_object_object_del(struct json_object* obj, const char *key); #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L # define json_object_object_foreach(obj,key,val) \ - char *key; \ - struct json_object *val __attribute__((__unused__)); \ + char *key = NULL; \ + struct json_object *val = NULL; \ for(struct lh_entry *entry ## key = json_object_get_object(obj)->head, *entry_next ## key = NULL; \ ({ if(entry ## key) { \ key = (char*)entry ## key->k; \