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

[PATCH 4/7] remove ugly shadowing of loop indexes in subloops.

From
Pierre Habouzit <madcoder@debian.org>
Date
Aug 23, 2006, 10:39 UTC
Message-ID
<11563295573215-git-send-email-madcoder@debian.org>
In-Reply-To
<1156329556788-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 builtin-mv.c |    6 +++---
 git.c        |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin-mv.c b/builtin-mv.c
index ff882be..fd1e520 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -262,10 +262,10 @@ int cmd_mv(int argc, const char **argv, 
 	} else {
 		for (i = 0; i < changed.nr; i++) {
 			const char *path = changed.items[i].path;
-			int i = cache_name_pos(path, strlen(path));
-			struct cache_entry *ce = active_cache[i];
+			int j = cache_name_pos(path, strlen(path));
+			struct cache_entry *ce = active_cache[j];
 
-			if (i < 0)
+			if (j < 0)
 				die ("Huh? Cache entry for %s unknown?", path);
 			refresh_cache_entry(ce, 0);
 		}
diff --git a/git.c b/git.c
index 930998b..a01d195 100644
--- a/git.c
+++ b/git.c
@@ -292,11 +292,11 @@ static void handle_internal_command(int 
 		if (p->option & USE_PAGER)
 			setup_pager();
 		if (getenv("GIT_TRACE")) {
-			int i;
+			int j;
 			fprintf(stderr, "trace: built-in: git");
-			for (i = 0; i < argc; ++i) {
+			for (j = 0; j < argc; ++j) {
 				fputc(' ', stderr);
-				sq_quote_print(stderr, argv[i]);
+				sq_quote_print(stderr, argv[j]);
 			}
 			putc('\n', stderr);
 			fflush(stderr);
-- 
1.4.1.1
Previous: Pierre HabouzitNext: Pierre Habouzit
Message 4 of 7 in “avoid to use error that shadows the function name, use err instead.”
  1. 1/7 avoid to use error that shadows the function name, use err instead.Pierre Habouzit, Aug 23, 2006
  2. 2/7 git_dir holds pointers to local strings, hence MUST be const.Pierre Habouzit, Aug 23, 2006
  3. 3/7 missing 'static' keywordsPierre Habouzit, Aug 23, 2006
  4. 4/7 remove ugly shadowing of loop indexes in subloops.Pierre Habouzit, Aug 23, 2006
  5. 5/7 missing #define DEBUG 0 that made the preprocessor whinePierre Habouzit, Aug 23, 2006
  6. 6/7 use name[len] in switch directly, instead of creating a shadowed variable.Pierre Habouzit, Aug 23, 2006
  7. 7/7 n is in fact unused, and is later shadowed.Pierre Habouzit, Aug 23, 2006

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.