git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Remove shadowing variable from traverse_trees()
@ 2007-01-04 18:33 René Scharfe
  0 siblings, 0 replies; only message in thread
From: René Scharfe @ 2007-01-04 18:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 tree-walk.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tree-walk.c b/tree-walk.c
index 14cc5ae..22f4550 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -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;
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-04 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-04 18:33 [PATCH] Remove shadowing variable from traverse_trees() René Scharfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).