From 147ee35558a300a7e51af5335ef59b09fd57ab7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 7 Dec 2019 12:16:04 +0100 Subject: [PATCH] commit: use strbuf_add() to add a length-limited string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is shorter and simpler. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/commit.c b/builtin/commit.c index 1c9e8e2228..599fd10a3e 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -534,7 +534,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); }