Skip to content

Commit d828f6d

Browse files
MadCoderJunio C Hamano
authored andcommitted
remove ugly shadowing of loop indexes in subloops.
builtin-mv.c and git.c has a nested loop that is governed by a variable 'i', but they shadow it with another instance of 'i'. Signed-off-by: Pierre Habouzit <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b5bf7cd commit d828f6d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

builtin-mv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
262262
} else {
263263
for (i = 0; i < changed.nr; i++) {
264264
const char *path = changed.items[i].path;
265-
int i = cache_name_pos(path, strlen(path));
266-
struct cache_entry *ce = active_cache[i];
265+
int j = cache_name_pos(path, strlen(path));
266+
struct cache_entry *ce = active_cache[j];
267267

268-
if (i < 0)
268+
if (j < 0)
269269
die ("Huh? Cache entry for %s unknown?", path);
270270
refresh_cache_entry(ce, 0);
271271
}

git.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
292292
if (p->option & USE_PAGER)
293293
setup_pager();
294294
if (getenv("GIT_TRACE")) {
295-
int i;
295+
int j;
296296
fprintf(stderr, "trace: built-in: git");
297-
for (i = 0; i < argc; ++i) {
297+
for (j = 0; j < argc; ++j) {
298298
fputc(' ', stderr);
299-
sq_quote_print(stderr, argv[i]);
299+
sq_quote_print(stderr, argv[j]);
300300
}
301301
putc('\n', stderr);
302302
fflush(stderr);

0 commit comments

Comments
 (0)