test-dir-iterator: use path argument directly
Avoid allocating and leaking a strbuf for holding a verbatim copy of the path argument and pass the latter directly to dir_iterator_begin() instead. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Aug 7, 2019 at 13:15 UTC
7df3bd462a7e8cd18f16ae33acc49fac15db7c3e
1 file changed
+1
-3
t/helper/test-dir-iterator.c
+1
-3
@@ -10,7 +10,6 @@
10
*/
11
int cmd__dir_iterator(int argc, const char **argv)
12
{
13
- struct strbuf path = STRBUF_INIT;
13
struct dir_iterator *diter;
14
unsigned int flags = 0;
15
int iter_status;
@@ -27,8 +26,7 @@ int cmd__dir_iterator(int argc, const char **argv)
26
if (!*argv || argc != 1)
27
die("dir-iterator needs exactly one non-option argument");
28
30
- strbuf_add(&path, *argv, strlen(*argv));
31
- diter = dir_iterator_begin(path.buf, flags);
29
+ diter = dir_iterator_begin(*argv, flags);
30
31
if (!diter) {
32
printf("dir_iterator_begin failure: %d\n", errno);