use get_cached_commit_buffer where appropriate
[gitweb.git] / commit.h
index cc89128894d2514ff70e5d46bc149c95b44a7760..259c0aec752c36d4782469783b4e4a113b413c35 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -57,6 +57,27 @@ void parse_commit_or_die(struct commit *item);
  */
 void set_commit_buffer(struct commit *, void *buffer);
 
+/*
+ * Get any cached object buffer associated with the commit. Returns NULL
+ * if none. The resulting memory should not be freed.
+ */
+const void *get_cached_commit_buffer(const struct commit *);
+
+/*
+ * Get the commit's object contents, either from cache or by reading the object
+ * from disk. The resulting memory should not be modified, and must be given
+ * to unuse_commit_buffer when the caller is done.
+ */
+const void *get_commit_buffer(const struct commit *);
+
+/*
+ * Tell the commit subsytem that we are done with a particular commit buffer.
+ * The commit and buffer should be the input and return value, respectively,
+ * 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.
+ */
+void unuse_commit_buffer(const struct commit *, const void *buffer);
+
 /*
  * Free any cached object buffer associated with the commit.
  */