{"thread":{"id":"6222","subject":"[PATCH] Remove shadowing variable from traverse_trees()","startedAt":"2007-01-04T18:33:36Z","lastAt":"2007-01-04T18:33:36Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"30829","messageId":"459D4880.9070804@lsrfire.ath.cx","threadId":"6222","inReplyTo":null,"subject":"[PATCH] Remove shadowing variable from traverse_trees()","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2007-01-04T18:33:36Z","receivedAt":"2007-01-04T18:33:36Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"The variable named entry is allocated using malloc() and then\nforgotten, it being shadowed by an automatic variable of the\nsame name.  Fixing the array size at 3 worked so far because\nthe only caller of traverse_trees() needed only as much\nentries.  Simply remove the shadowing varaible and we're able\nto traverse more than three trees and save stack space at the\nsame time!\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n---\n tree-walk.c |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 14cc5ae..22f4550 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -113,7 +113,6 @@ void traverse_trees(int n, struct tree_desc *t, const char *base, traverse_callb\n \tstruct name_entry *entry = xmalloc(n*sizeof(*entry));\n \n \tfor (;;) {\n-\t\tstruct name_entry entry[3];\n \t\tunsigned long mask = 0;\n \t\tint i, last;\n \n"}]}