summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-10-27 12:03:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-27 12:03:37 -0700
commit82bc9f515c93cdb66f87092c7e270b8de112919f (patch)
treef48a26ac8b1a50605da3860e49a071742fef1e26 /read-cache.c
parentMerge branch 'maint' (diff)
parentMerge branch 'rs/maint-estimate-cache-size' into maint (diff)
downloadtgif-82bc9f515c93cdb66f87092c7e270b8de112919f.tar.xz
Merge branch 'maint'
* maint: clone: Quote user supplied path in a single quote pair read-cache.c: fix index memory allocation
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c
index 01a0e25051..5790a91044 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1249,9 +1249,9 @@ static void convert_from_disk(struct ondisk_cache_entry *ondisk, struct cache_en
static inline size_t estimate_cache_size(size_t ondisk_size, unsigned int entries)
{
- long per_entry;
-
- per_entry = sizeof(struct cache_entry) - sizeof(struct ondisk_cache_entry);
+ size_t fix_size_mem = offsetof(struct cache_entry, name);
+ size_t fix_size_dsk = offsetof(struct ondisk_cache_entry, name);
+ long per_entry = (fix_size_mem - fix_size_dsk + 7) & ~7;
/*
* Alignment can cause differences. This should be "alignof", but