1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 12:59:41 +01:00

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>
This commit is contained in:
René Scharfe 2012-05-11 16:59:25 +02:00 committed by Junio C Hamano
parent 1528d247e5
commit 2b189435f3

9
dir.c
View file

@ -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;
}