diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:43 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:43 -0700 |
commit | ae533c4a92aef6ab180441dbb76ef83521fc87d6 (patch) | |
tree | 0e722c62f6fb4a7d053bdb9bcb37115d8946336b /blame.c | |
parent | Merge branch 'jt/fetch-nego-tip' (diff) | |
parent | block alloc: add validations around cache_entry lifecyle (diff) | |
download | tgif-ae533c4a92aef6ab180441dbb76ef83521fc87d6.tar.xz |
Merge branch 'jm/cache-entry-from-mem-pool'
For a large tree, the index needs to hold many cache entries
allocated on heap. These cache entries are now allocated out of a
dedicated memory pool to amortize malloc(3) overhead.
* jm/cache-entry-from-mem-pool:
block alloc: add validations around cache_entry lifecyle
block alloc: allocate cache entries from mem_pool
mem-pool: fill out functionality
mem-pool: add life cycle management functions
mem-pool: only search head block for available space
block alloc: add lifecycle APIs for cache_entry structs
read-cache: teach make_cache_entry to take object_id
read-cache: teach refresh_cache_entry to take istate
Diffstat (limited to 'blame.c')
-rw-r--r-- | blame.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -176,7 +176,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, struct strbuf buf = STRBUF_INIT; const char *ident; time_t now; - int size, len; + int len; struct cache_entry *ce; unsigned mode; struct strbuf msg = STRBUF_INIT; @@ -274,8 +274,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, /* Let's not bother reading from HEAD tree */ mode = S_IFREG | 0644; } - size = cache_entry_size(len); - ce = xcalloc(1, size); + ce = make_empty_cache_entry(&the_index, len); oidcpy(&ce->oid, &origin->blob_oid); memcpy(ce->name, path, len); ce->ce_flags = create_ce_flags(0); |