Skip to content

Commit 7df3bd4

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9b7b029 commit 7df3bd4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

t/helper/test-dir-iterator.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
int cmd__dir_iterator(int argc, const char **argv)
1212
{
13-
struct strbuf path = STRBUF_INIT;
1413
struct dir_iterator *diter;
1514
unsigned int flags = 0;
1615
int iter_status;
@@ -27,8 +26,7 @@ int cmd__dir_iterator(int argc, const char **argv)
2726
if (!*argv || argc != 1)
2827
die("dir-iterator needs exactly one non-option argument");
2928

30-
strbuf_add(&path, *argv, strlen(*argv));
31-
diter = dir_iterator_begin(path.buf, flags);
29+
diter = dir_iterator_begin(*argv, flags);
3230

3331
if (!diter) {
3432
printf("dir_iterator_begin failure: %d\n", errno);

0 commit comments

Comments
 (0)