summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2018-01-17 17:54:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-17 20:21:32 (GMT)
commitea6577303f4059683f8f257bdecbcafb05001ce9 (patch)
tree1ac60041f78ab7af5f557bc8b2028b73994bfa52 /cache.h
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-ea6577303f4059683f8f257bdecbcafb05001ce9.zip
git-ea6577303f4059683f8f257bdecbcafb05001ce9.tar.gz
git-ea6577303f4059683f8f257bdecbcafb05001ce9.tar.bz2
sha1_file: remove static strbuf from sha1_file_name()
Using a static buffer in sha1_file_name() is error prone and the performance improvements it gives are not needed in many of the callers. So let's get rid of this static buffer and, if necessary or helpful, let's use one in the caller. Suggested-by: Jeff Hostetler <git@jeffhostetler.com> Helped-by: Kevin Daudt <me@ikke.info> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/cache.h b/cache.h
index 6440e2b..269dfc0 100644
--- a/cache.h
+++ b/cache.h
@@ -902,12 +902,10 @@ extern void check_repository_format(void);
#define TYPE_CHANGED 0x0040
/*
- * Return the name of the file in the local object database that would
- * be used to store a loose object with the specified sha1. The
- * return value is a pointer to a statically allocated buffer that is
- * overwritten each time the function is called.
+ * Put in `buf` the name of the file in the local object database that
+ * would be used to store a loose object with the specified sha1.
*/
-extern const char *sha1_file_name(const unsigned char *sha1);
+extern void sha1_file_name(struct strbuf *buf, const unsigned char *sha1);
/*
* Return an abbreviated sha1 unique within this repository's object database.