commit.c: allow set_commit_buffer to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jun 28, 2018 at 18:22 UTC 1a40fc4509fb5369f089ed8774871e5e6974d3c2
2 files changed +3 -4
commit.c
+2 -2
@@ -275,10 +275,10 @@ void free_commit_buffer_slab(struct buffer_slab *bs)
275 free(bs);
276 }
277
278 -void set_commit_buffer_the_repository(struct commit *commit, void *buffer, unsigned long size)
278 +void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer, unsigned long size)
279 {
280 struct commit_buffer *v = buffer_slab_at(
281 - the_repository->parsed_objects->buffer_slab, commit);
281 + r->parsed_objects->buffer_slab, commit);
282 v->buffer = buffer;
283 v->size = size;
284 }
commit.h
+1 -2
@@ -97,8 +97,7 @@ void free_commit_buffer_slab(struct buffer_slab *bs);
97 * Associate an object buffer with the commit. The ownership of the
98 * memory is handed over to the commit, and must be free()-able.
99 */
100 -#define set_commit_buffer(r, c, b, s) set_commit_buffer_##r(c, b, s)
101 -void set_commit_buffer_the_repository(struct commit *, void *buffer, unsigned long size);
100 +void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsigned long size);
101
102 /*
103 * Get any cached object buffer associated with the commit. Returns NULL