From: David Aguilar <davvid@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: [PATCH v7 3/4] difftool: remove an unnecessary call to strbuf_release()
Date: Thu, 30 Sep 2021 18:37:55 -0700 [thread overview]
Message-ID: <20211001013756.37586-4-davvid@gmail.com> (raw)
In-Reply-To: <20211001013756.37586-1-davvid@gmail.com>
The `buf` strbuf is reused again later in the same function, so there
is no benefit to calling strbuf_release(). The subsequent usage is
already using strbuf_reset() to reset the buffer, so releasing it
early is only going to lead to a wasteful reallocation.
Remove the early call to strbuf_release(). The same strbuf is already
cleaned up in the "finish:" section so nothing is leaked, either.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
builtin/difftool.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/builtin/difftool.c b/builtin/difftool.c
index f3cd1e5b53..437474fea0 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -568,8 +568,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
write_standin_files(entry, &ldir, ldir_len, &rdir, rdir_len);
}
- strbuf_release(&buf);
-
strbuf_setlen(&ldir, ldir_len);
helper_argv[1] = ldir.buf;
strbuf_setlen(&rdir, rdir_len);
--
2.33.0.886.g5b6dfe5e5c
next prev parent reply other threads:[~2021-10-01 1:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 1:37 [PATCH v7 0/4] difftool: dir-diff improvements and refactoring David Aguilar
2021-10-01 1:37 ` [PATCH v7 1/4] difftool: create a tmpdir path without repeated slashes David Aguilar
2021-10-01 1:37 ` [PATCH v7 2/4] difftool: refactor dir-diff to write files using helper functions David Aguilar
2021-10-01 1:37 ` David Aguilar [this message]
2021-10-01 1:37 ` [PATCH v7 4/4] difftool: add a missing space to the run_dir_diff() comments David Aguilar
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211001013756.37586-4-davvid@gmail.com \
--to=davvid@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).