summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2018-01-18 10:08:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-19 21:21:49 (GMT)
commit3449847168c9fa6e23db364e7da9077eadd39547 (patch)
treea95291813f860c98929b5c5c7c83ddfbb0053c0f /sha1_file.c
parentea6577303f4059683f8f257bdecbcafb05001ce9 (diff)
downloadgit-3449847168c9fa6e23db364e7da9077eadd39547.zip
git-3449847168c9fa6e23db364e7da9077eadd39547.tar.gz
git-3449847168c9fa6e23db364e7da9077eadd39547.tar.bz2
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 <stolee@gmail.com> Helped-by: Jeff Hostetler <git@jeffhostetler.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 740dda4..d82cf1b 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);
}