All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] commit: use strbuf_add() to add a length-limited string
@ 2019-12-07 11:16 René Scharfe
  2019-12-07 20:17 ` Derrick Stolee
  2019-12-09 19:24 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: René Scharfe @ 2019-12-07 11:16 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

This is shorter and simpler.

Signed-off-by: René 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 294dc574cd..35a1fb9ad6 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -537,7 +537,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.24.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-09 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-07 11:16 [PATCH] commit: use strbuf_add() to add a length-limited string René Scharfe
2019-12-07 20:17 ` Derrick Stolee
2019-12-09 19:24 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.