summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-10-01 10:28:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-01 20:50:01 (GMT)
commitcf6950d3bfe1447ac04867b1f5654a2fc9c5db96 (patch)
tree2c99e3011a6e6f27286091a7066fe8c91683bcd1 /cache.h
parent3e88e8fc085bbfad142d51a07ef918b9b5ca1d72 (diff)
downloadgit-cf6950d3bfe1447ac04867b1f5654a2fc9c5db96.zip
git-cf6950d3bfe1447ac04867b1f5654a2fc9c5db96.tar.gz
git-cf6950d3bfe1447ac04867b1f5654a2fc9c5db96.tar.bz2
lockfile: change lock_file::filename into a strbuf
For now, we still make sure to allocate at least PATH_MAX characters for the strbuf because resolve_symlink() doesn't know how to expand the space for its return value. (That will be fixed in a moment.) Another alternative would be to just use a strbuf as scratch space in lock_file() but then store a pointer to the naked string in struct lock_file. But lock_file objects are often reused. By reusing the same strbuf, we can avoid having to reallocate the string most times when a lock_file object is reused. Helped-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index c2ea6f1..f81d95f 100644
--- a/cache.h
+++ b/cache.h
@@ -580,7 +580,7 @@ struct lock_file {
volatile int fd;
volatile pid_t owner;
char on_list;
- char filename[PATH_MAX];
+ struct strbuf filename;
};
#define LOCK_DIE_ON_ERROR 1
#define LOCK_NODEREF 2