提交 2b189435 编写于 作者: R René Scharfe 提交者: Junio C Hamano

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: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 1528d247
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册