diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-27 12:03:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-27 12:03:37 -0700 |
commit | 82bc9f515c93cdb66f87092c7e270b8de112919f (patch) | |
tree | f48a26ac8b1a50605da3860e49a071742fef1e26 /read-cache.c | |
parent | Merge branch 'maint' (diff) | |
parent | Merge branch 'rs/maint-estimate-cache-size' into maint (diff) | |
download | tgif-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.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 |