From 3449847168c9fa6e23db364e7da9077eadd39547 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 18 Jan 2018 11:08:54 +0100 Subject: [PATCH] sha1_file: improve sha1_file_name() perfs As sha1_file_name() could be performance sensitive, let's make it faster by using strbuf_addstr() and strbuf_addc() instead of strbuf_addf(). Helped-by: Derrick Stolee Helped-by: Jeff Hostetler Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- sha1_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index 740dda4cfc..d82cf1b4a4 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -253,8 +253,8 @@ static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1) void sha1_file_name(struct strbuf *buf, const unsigned char *sha1) { - strbuf_addf(buf, "%s/", get_object_directory()); - + strbuf_addstr(buf, get_object_directory()); + strbuf_addch(buf, '/'); fill_sha1_path(buf, sha1); } -- 2.11.4.GIT