summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-11-29 09:11:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-29 09:11:46 (GMT)
commit686a4a06b679a202430ca81267ad6505e92d839a (patch)
tree7d846000c4827f08e913acccb520c108d83b044b /dir.c
parentd25430c5f88c7e7b4ce24c1b08e409f4345c4eb9 (diff)
downloadgit-686a4a06b679a202430ca81267ad6505e92d839a.zip
git-686a4a06b679a202430ca81267ad6505e92d839a.tar.gz
git-686a4a06b679a202430ca81267ad6505e92d839a.tar.bz2
dir.c: minor clean-up
Replace handcrafted reallocation with ALLOC_GROW(). Reindent "file_exists()" helper function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/dir.c b/dir.c
index 225fdfb..7c97483 100644
--- a/dir.c
+++ b/dir.c
@@ -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;
}
@@ -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;
}
/*