diff options
author | Stefan Beller <sbeller@google.com> | 2018-12-14 16:09:40 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-12-28 10:06:33 -0800 |
commit | 6a7895fd8a3bd409f2b71ffc355d5142172cc2a0 (patch) | |
tree | fc7736800e138da6506f50485fb246615dde0ad5 /commit.c | |
parent | commit-graph: convert remaining functions to handle any repo (diff) | |
download | tgif-6a7895fd8a3bd409f2b71ffc355d5142172cc2a0.tar.xz |
commit: prepare free_commit_buffer and release_commit_memory for any repo
Pass the object pool to free_commit_buffer and release_commit_memory,
such that we can eliminate access to 'the_repository'.
Also remove the TODO in release_commit_memory, as commit->util was
removed in 9d2c97016f (commit.h: delete 'util' field in struct commit,
2018-05-19)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -328,10 +328,10 @@ void repo_unuse_commit_buffer(struct repository *r, free((void *)buffer); } -void free_commit_buffer(struct commit *commit) +void free_commit_buffer(struct parsed_object_pool *pool, struct commit *commit) { struct commit_buffer *v = buffer_slab_peek( - the_repository->parsed_objects->buffer_slab, commit); + pool->buffer_slab, commit); if (v) { FREE_AND_NULL(v->buffer); v->size = 0; @@ -354,13 +354,12 @@ struct object_id *get_commit_tree_oid(const struct commit *commit) return &get_commit_tree(commit)->object.oid; } -void release_commit_memory(struct commit *c) +void release_commit_memory(struct parsed_object_pool *pool, struct commit *c) { c->maybe_tree = NULL; c->index = 0; - free_commit_buffer(c); + free_commit_buffer(pool, c); free_commit_list(c->parents); - /* TODO: what about commit->util? */ c->object.parsed = 0; } |