Skip to content

Commit

Permalink
read_directory_recursive: reduce one indentation level
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Oct 27, 2011
1 parent 5fb8c05 commit 02cb675
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,34 +968,34 @@ static int read_directory_recursive(struct dir_struct *dir,
{
DIR *fdir = opendir(*base ? base : ".");
int contents = 0;
struct dirent *de;
char path[PATH_MAX + 1];

if (fdir) {
struct dirent *de;
char path[PATH_MAX + 1];
memcpy(path, base, baselen);

while ((de = readdir(fdir)) != NULL) {
int len;
switch (treat_path(dir, de, path, sizeof(path),
baselen, simplify, &len)) {
case path_recurse:
contents += read_directory_recursive
(dir, path, len, 0, simplify);
continue;
case path_ignored:
continue;
case path_handled:
break;
}
contents++;
if (check_only)
goto exit_early;
else
dir_add_name(dir, path, len);
if (!fdir)
return 0;

memcpy(path, base, baselen);

while ((de = readdir(fdir)) != NULL) {
int len;
switch (treat_path(dir, de, path, sizeof(path),
baselen, simplify, &len)) {
case path_recurse:
contents += read_directory_recursive(dir, path, len, 0, simplify);
continue;
case path_ignored:
continue;
case path_handled:
break;
}
exit_early:
closedir(fdir);
contents++;
if (check_only)
goto exit_early;
else
dir_add_name(dir, path, len);
}
exit_early:
closedir(fdir);

return contents;
}
Expand Down

0 comments on commit 02cb675

Please sign in to comment.