From 7df3bd462a7e8cd18f16ae33acc49fac15db7c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 7 Aug 2019 13:15:20 +0200 Subject: test-dir-iterator: use path argument directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- t/helper/test-dir-iterator.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 't') diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c index a5b96cb0dc..b421d2bf38 100644 --- a/t/helper/test-dir-iterator.c +++ b/t/helper/test-dir-iterator.c @@ -10,7 +10,6 @@ */ int cmd__dir_iterator(int argc, const char **argv) { - struct strbuf path = STRBUF_INIT; struct dir_iterator *diter; unsigned int flags = 0; int iter_status; @@ -27,8 +26,7 @@ int cmd__dir_iterator(int argc, const char **argv) if (!*argv || argc != 1) die("dir-iterator needs exactly one non-option argument"); - strbuf_add(&path, *argv, strlen(*argv)); - diter = dir_iterator_begin(path.buf, flags); + diter = dir_iterator_begin(*argv, flags); if (!diter) { printf("dir_iterator_begin failure: %d\n", errno); -- cgit v1.2.3