git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] dir.c: remove the second declaration of "stk" in prep_exclude()

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 21, 2014, 11:38 UTC
Message-ID
<1413891486-24573-1-git-send-email-pclouds@gmail.com>

This "stk" shadows the first declaration at the top. There's currently no bad effect. But let's avoid it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dir.c b/dir.c
index bd274a7..3f7a025 100644
--- a/dir.c
+++ b/dir.c
@@ -826,9 +826,9 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
 	current = stk ? stk->baselen : -1;
 	strbuf_setlen(&dir->basebuf, current < 0 ? 0 : current);
 	while (current < baselen) {
-		struct exclude_stack *stk = xcalloc(1, sizeof(*stk));
 		const char *cp;
 
+		stk = xcalloc(1, sizeof(*stk));
 		if (current < 0) {
 			cp = base;
 			current = 0;
-- 
2.1.0.rc0.78.gc0d8480
Message 1 of 1 in “dir.c: remove the second declaration of "stk" in prep_exclude()”
  1. dir.c: remove the second declaration of "stk" in prep_exclude()Nguyễn Thái Ngọc Duy, Oct 21, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.