read_directory_recursive: reduce one indentation level

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2011-10-24 17:36:11 +11:00 committed by Junio C Hamano
parent 5fb8c05f2e
commit 02cb67530e

48
dir.c
View File

@ -968,34 +968,34 @@ static int read_directory_recursive(struct dir_struct *dir,
{ {
DIR *fdir = opendir(*base ? base : "."); DIR *fdir = opendir(*base ? base : ".");
int contents = 0; int contents = 0;
struct dirent *de;
char path[PATH_MAX + 1];
if (fdir) { if (!fdir)
struct dirent *de; return 0;
char path[PATH_MAX + 1];
memcpy(path, base, baselen);
while ((de = readdir(fdir)) != NULL) { memcpy(path, base, baselen);
int len;
switch (treat_path(dir, de, path, sizeof(path), while ((de = readdir(fdir)) != NULL) {
baselen, simplify, &len)) { int len;
case path_recurse: switch (treat_path(dir, de, path, sizeof(path),
contents += read_directory_recursive baselen, simplify, &len)) {
(dir, path, len, 0, simplify); case path_recurse:
continue; contents += read_directory_recursive(dir, path, len, 0, simplify);
case path_ignored: continue;
continue; case path_ignored:
case path_handled: continue;
break; case path_handled:
} break;
contents++;
if (check_only)
goto exit_early;
else
dir_add_name(dir, path, len);
} }
exit_early: contents++;
closedir(fdir); if (check_only)
goto exit_early;
else
dir_add_name(dir, path, len);
} }
exit_early:
closedir(fdir);
return contents; return contents;
} }