summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-05-11 16:59:25 +0200
committerJunio C Hamano <gitster@pobox.com>2012-05-11 14:31:32 -0700
commit2b189435f341cb2c7089af4f22e307405e6243df (patch)
tree3af33129d48e38a2e193687640ab5a444167f9aa /dir.c
parent1528d247e53bcf33db5b004a25a7d9b8c75c90e4 (diff)
downloadgit-2b189435f341cb2c7089af4f22e307405e6243df.tar.gz
dir: simplify fill_directory()
Now that read_directory_recursive() (reached through read_directory()) respects the string length limit we provide, we don't need to create a NUL-limited copy of the common prefix anymore. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/dir.c b/dir.c
index d5444fbe9b..ed1510fbc8 100644
--- a/dir.c
+++ b/dir.c
@@ -74,7 +74,6 @@ char *common_prefix(const char **pathspec)
int fill_directory(struct dir_struct *dir, const char **pathspec)
{
- const char *path;
size_t len;
/*
@@ -82,15 +81,9 @@ int fill_directory(struct dir_struct *dir, const char **pathspec)
* use that to optimize the directory walk
*/
len = common_prefix_len(pathspec);
- path = "";
-
- if (len)
- path = xmemdupz(*pathspec, len);
/* Read the directory and prune it */
- read_directory(dir, path, len, pathspec);
- if (*path)
- free((char *)path);
+ read_directory(dir, pathspec ? *pathspec : "", len, pathspec);
return len;
}