1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 07:56:11 +02:00

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>
This commit is contained in:
Stefan Beller 2018-06-28 18:22:16 -07:00 committed by Junio C Hamano
parent 65ea9d4bec
commit 1a40fc4509
2 changed files with 3 additions and 4 deletions

View File

@ -275,10 +275,10 @@ void free_commit_buffer_slab(struct buffer_slab *bs)
free(bs); free(bs);
} }
void set_commit_buffer_the_repository(struct commit *commit, void *buffer, unsigned long size) void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer, unsigned long size)
{ {
struct commit_buffer *v = buffer_slab_at( struct commit_buffer *v = buffer_slab_at(
the_repository->parsed_objects->buffer_slab, commit); r->parsed_objects->buffer_slab, commit);
v->buffer = buffer; v->buffer = buffer;
v->size = size; v->size = size;
} }

View File

@ -97,8 +97,7 @@ void free_commit_buffer_slab(struct buffer_slab *bs);
* Associate an object buffer with the commit. The ownership of the * Associate an object buffer with the commit. The ownership of the
* memory is handed over to the commit, and must be free()-able. * memory is handed over to the commit, and must be free()-able.
*/ */
#define set_commit_buffer(r, c, b, s) set_commit_buffer_##r(c, b, s) void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsigned long size);
void set_commit_buffer_the_repository(struct commit *, void *buffer, unsigned long size);
/* /*
* Get any cached object buffer associated with the commit. Returns NULL * Get any cached object buffer associated with the commit. Returns NULL