commit.c: allow get_cached_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
4ff7e5c9362875b2296fd2e289dba487a38609f0
2 files changed
+3
-4
commit.c
+2
-2
@@ -283,10 +283,10 @@ void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer
283
v->size = size;
284
}
285
286
-const void *get_cached_commit_buffer_the_repository(const struct commit *commit, unsigned long *sizep)
286
+const void *get_cached_commit_buffer(struct repository *r, const struct commit *commit, unsigned long *sizep)
287
{
288
struct commit_buffer *v = buffer_slab_peek(
289
- the_repository->parsed_objects->buffer_slab, commit);
289
+ r->parsed_objects->buffer_slab, commit);
290
if (!v) {
291
if (sizep)
292
*sizep = 0;
commit.h
+1
-2
@@ -103,8 +103,7 @@ void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsi
103
* Get any cached object buffer associated with the commit. Returns NULL
104
* if none. The resulting memory should not be freed.
105
*/
106
-#define get_cached_commit_buffer(r, c, s) get_cached_commit_buffer_##r(c, s)
107
-const void *get_cached_commit_buffer_the_repository(const struct commit *, unsigned long *size);
106
+const void *get_cached_commit_buffer(struct repository *, const struct commit *, unsigned long *size);
107
108
/*
109
* Get the commit's object contents, either from cache or by reading the object