diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-27 12:03:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-27 12:03:16 -0700 |
commit | a76a326b2af925ab45d2cfffbb6d925763eb6e5d (patch) | |
tree | dc7edc297a107f6dcbdc85957a4108750f8a954a /read-cache.c | |
parent | clone: Quote user supplied path in a single quote pair (diff) | |
parent | read-cache.c: fix index memory allocation (diff) | |
download | tgif-a76a326b2af925ab45d2cfffbb6d925763eb6e5d.tar.xz |
Merge branch 'rs/maint-estimate-cache-size' into maint
* rs/maint-estimate-cache-size:
read-cache.c: fix index memory allocation
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 6 |
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 |