Skip to content

Commit

Permalink
Rename a varialble that shadows another one
Browse files Browse the repository at this point in the history
Fixes #430
  • Loading branch information
akheron committed Aug 12, 2018
1 parent 360b1ef commit 020cc26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -144,7 +144,7 @@ if test x$GCC = xyes; then
[AC_MSG_RESULT(no)
wnoformat_truncation=""])

AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement ${wnoformat_truncation}"
AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement -Wshadow ${wnoformat_truncation}"
fi
AC_SUBST([AM_CFLAGS])

Expand Down
8 changes: 4 additions & 4 deletions src/dump.c
Expand Up @@ -306,7 +306,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
const char *separator;
int separator_length;
/* 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) {
separator = ":";
Expand All @@ -318,15 +318,15 @@ static int do_dump(const json_t *json, size_t flags, int depth,
}

/* detect circular references */
if (loop_check(parents, json, key, sizeof(key)))
if (loop_check(parents, json, loop_key, sizeof(loop_key)))
return -1;

iter = json_object_iter((json_t *)json);

if(!embed && dump("{", 1, data))
return -1;
if(!iter) {
hashtable_del(parents, key);
hashtable_del(parents, loop_key);
return embed ? 0 : dump("}", 1, data);
}
if(dump_indent(flags, depth + 1, 0, dump, data))
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 020cc26

Please sign in to comment.