list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: "René Scharfe" <>
To: Git Mailing List <>
Cc: Junio C Hamano <>, Daniel Ferreira <>
Subject: [PATCH] test-dir-iterator: use path argument directly
Date: Wed, 7 Aug 2019 13:15:20 +0200
Message-ID: <> (raw)

Avoid allocating and leaking a strbuf for holding a verbatim copy of the
path argument and pass the latter directly to dir_iterator_begin()

Signed-off-by: René Scharfe <>
This test helper was added after v2.22.0 (2019-06-07) by 150791adbf
(dir-iterator: add tests for dir-iterator API, 2019-07-10).

 t/helper/test-dir-iterator.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
index c7c30664da..659b6bfa81 100644
--- a/t/helper/test-dir-iterator.c
+++ b/t/helper/test-dir-iterator.c
@@ -19,7 +19,6 @@ static const char *error_name(int error_number)
 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;
@@ -36,8 +35,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: %s\n", error_name(errno));

             reply	other threads:[~2019-08-07 11:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 11:15 René Scharfe [this message]
2019-08-07 13:57 ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for the project(s) associated with this inbox:

AGPL code for this site: git clone