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>

René Scharfe committed May 11, 2012 at 16:59 UTC 2b189435f341cb2c7089af4f22e307405e6243df
1 file changed +1 -8
dir.c
+1 -8
@@ -74,7 +74,6 @@ char *common_prefix(const char **pathspec)
74
75 int fill_directory(struct dir_struct *dir, const char **pathspec)
76 {
77 - const char *path;
77 size_t len;
78
79 /*
@@ -82,15 +81,9 @@ int fill_directory(struct dir_struct *dir, const char **pathspec)
81 * use that to optimize the directory walk
82 */
83 len = common_prefix_len(pathspec);
85 - path = "";
86 -
87 - if (len)
88 - path = xmemdupz(*pathspec, len);
84
85 /* Read the directory and prune it */
91 - read_directory(dir, path, len, pathspec);
92 - if (*path)
93 - free((char *)path);
86 + read_directory(dir, pathspec ? *pathspec : "", len, pathspec);
87 return len;
88 }
89