From: "René Scharfe" <l.s.r@web.de>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] commit: use strbuf_add() to add a buffer to a strbuf
Date: Sun, 1 Oct 2017 16:54:14 +0200 [thread overview]
Message-ID: <223ef0c8-dac2-747b-41c8-3bad62f4c274@web.de> (raw)
In-Reply-To: <85605bc6-2e91-7132-ce63-f6e08a08a768@web.de>
This is shorter, easier and makes the intent clearer.
Patch generated with Coccinelle and contrib/coccinelle/strbuf.cocci.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
builtin/commit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 0f8ddb6866..d186736617 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -542,7 +542,7 @@ static void export_one(const char *var, const char *s, const char *e, int hack)
struct strbuf buf = STRBUF_INIT;
if (hack)
strbuf_addch(&buf, hack);
- strbuf_addf(&buf, "%.*s", (int)(e - s), s);
+ strbuf_add(&buf, s, e - s);
setenv(var, buf.buf, 1);
strbuf_release(&buf);
}
--
2.14.2
next prev parent reply other threads:[~2017-10-01 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-01 14:49 [PATCH 1/2] coccinelle: add rules to use strbuf_add() for adding buffers to strbufs René Scharfe
2017-10-01 14:54 ` René Scharfe [this message]
2017-10-02 5:18 ` [PATCH 2/2] commit: use strbuf_add() to add a buffer to a strbuf Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=223ef0c8-dac2-747b-41c8-3bad62f4c274@web.de \
--to=l.s.r@web.de \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).