Skip to content

Commit

Permalink
dir.c: minor clean-up
Browse files Browse the repository at this point in the history
Replace handcrafted reallocation with ALLOC_GROW().
Reindent "file_exists()" helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 29, 2007
1 parent d25430c commit 686a4a0
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ void add_exclude(const char *string, const char *base,
x->flags |= EXC_FLAG_NOWILDCARD;
if (*string == '*' && no_wildcard(string+1))
x->flags |= EXC_FLAG_ENDSWITH;
if (which->nr == which->alloc) {
which->alloc = alloc_nr(which->alloc);
which->excludes = xrealloc(which->excludes,
which->alloc * sizeof(x));
}
ALLOC_GROW(which->excludes, which->nr + 1, which->alloc);
which->excludes[which->nr++] = x;
}

Expand Down Expand Up @@ -690,11 +686,10 @@ int read_directory(struct dir_struct *dir, const char *path, const char *base, i
return dir->nr;
}

int
file_exists(const char *f)
int file_exists(const char *f)
{
struct stat sb;
return stat(f, &sb) == 0;
struct stat sb;
return stat(f, &sb) == 0;
}

/*
Expand Down

0 comments on commit 686a4a0

Please sign in to comment.