mirror of
https://github.com/git/git.git
synced 2024-05-09 07:56:11 +02:00
commit: prepare repo_unuse_commit_buffer to handle any repo
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
07de3fd840
commit
70315373ae
6
commit.c
6
commit.c
|
@ -318,10 +318,12 @@ const void *repo_get_commit_buffer(struct repository *r,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unuse_commit_buffer(const struct commit *commit, const void *buffer)
|
void repo_unuse_commit_buffer(struct repository *r,
|
||||||
|
const struct commit *commit,
|
||||||
|
const void *buffer)
|
||||||
{
|
{
|
||||||
struct commit_buffer *v = buffer_slab_peek(
|
struct commit_buffer *v = buffer_slab_peek(
|
||||||
the_repository->parsed_objects->buffer_slab, commit);
|
r->parsed_objects->buffer_slab, commit);
|
||||||
if (!(v && v->buffer == buffer))
|
if (!(v && v->buffer == buffer))
|
||||||
free((void *)buffer);
|
free((void *)buffer);
|
||||||
}
|
}
|
||||||
|
|
7
commit.h
7
commit.h
|
@ -130,7 +130,12 @@ const void *repo_get_commit_buffer(struct repository *r,
|
||||||
* from an earlier call to get_commit_buffer. The buffer may or may not be
|
* from an earlier call to get_commit_buffer. The buffer may or may not be
|
||||||
* freed by this call; callers should not access the memory afterwards.
|
* freed by this call; callers should not access the memory afterwards.
|
||||||
*/
|
*/
|
||||||
void unuse_commit_buffer(const struct commit *, const void *buffer);
|
void repo_unuse_commit_buffer(struct repository *r,
|
||||||
|
const struct commit *,
|
||||||
|
const void *buffer);
|
||||||
|
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
|
||||||
|
#define unuse_commit_buffer(c, b) repo_unuse_commit_buffer(the_repository, c, b)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free any cached object buffer associated with the commit.
|
* Free any cached object buffer associated with the commit.
|
||||||
|
|
|
@ -115,3 +115,11 @@ expression F;
|
||||||
- get_commit_buffer(
|
- get_commit_buffer(
|
||||||
+ repo_get_commit_buffer(the_repository,
|
+ repo_get_commit_buffer(the_repository,
|
||||||
E, F);
|
E, F);
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E;
|
||||||
|
expression F;
|
||||||
|
@@
|
||||||
|
- unuse_commit_buffer(
|
||||||
|
+ repo_unuse_commit_buffer(the_repository,
|
||||||
|
E, F);
|
||||||
|
|
Loading…
Reference in New Issue