Skip to content

Commit

Permalink
Remove shadowing variable from traverse_trees()
Browse files Browse the repository at this point in the history
The variable named entry is allocated using malloc() and then
forgotten, it being shadowed by an automatic variable of the
same name.  Fixing the array size at 3 worked so far because
the only caller of traverse_trees() needed only as much
entries.  Simply remove the shadowing varaible and we're able
to traverse more than three trees and save stack space at the
same time!

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Jan 5, 2007
1 parent 7c4c9f4 commit 4fe2cc0
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion tree-walk.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ void traverse_trees(int n, struct tree_desc *t, const char *base, traverse_callb
struct name_entry *entry = xmalloc(n*sizeof(*entry));

for (;;) {
struct name_entry entry[3];
unsigned long mask = 0;
int i, last;

Expand Down

0 comments on commit 4fe2cc0

Please sign in to comment.