Rename a varialble that shadows another one

Fixes #430
This commit is contained in:
Petri Lehtinen 2018-08-12 18:25:51 +03:00
parent 360b1ef5a1
commit 020cc26b5c
2 changed files with 5 additions and 5 deletions

View File

@ -144,7 +144,7 @@ if test x$GCC = xyes; then
[AC_MSG_RESULT(no) [AC_MSG_RESULT(no)
wnoformat_truncation=""]) wnoformat_truncation=""])
AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement ${wnoformat_truncation}" AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement -Wshadow ${wnoformat_truncation}"
fi fi
AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_CFLAGS])

View File

@ -306,7 +306,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
const char *separator; const char *separator;
int separator_length; int separator_length;
/* Space for "0x", double the sizeof a pointer for the hex and a terminator. */ /* Space for "0x", double the sizeof a pointer for the hex and a terminator. */
char key[2 + (sizeof(json) * 2) + 1]; char loop_key[2 + (sizeof(json) * 2) + 1];
if(flags & JSON_COMPACT) { if(flags & JSON_COMPACT) {
separator = ":"; separator = ":";
@ -318,7 +318,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
} }
/* detect circular references */ /* detect circular references */
if (loop_check(parents, json, key, sizeof(key))) if (loop_check(parents, json, loop_key, sizeof(loop_key)))
return -1; return -1;
iter = json_object_iter((json_t *)json); iter = json_object_iter((json_t *)json);
@ -326,7 +326,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
if(!embed && dump("{", 1, data)) if(!embed && dump("{", 1, data))
return -1; return -1;
if(!iter) { if(!iter) {
hashtable_del(parents, key); hashtable_del(parents, loop_key);
return embed ? 0 : dump("}", 1, data); return embed ? 0 : dump("}", 1, data);
} }
if(dump_indent(flags, depth + 1, 0, dump, data)) if(dump_indent(flags, depth + 1, 0, dump, data))
@ -422,7 +422,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
} }
} }
hashtable_del(parents, key); hashtable_del(parents, loop_key);
return embed ? 0 : dump("}", 1, data); return embed ? 0 : dump("}", 1, data);
} }