diff options
author | Vicent Martà <vicent@github.com> | 2013-04-22 08:07:20 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-04-22 08:07:20 -0700 |
commit | d08dd728a80eb993d80ec30d8c9f9025664c8990 (patch) | |
tree | f5cf7daf3913578f57076c2efc94bfd1f728068c /src/commit.c | |
parent | a92dd316079250b27cc933b1fd00cd6af88b88d9 (diff) | |
parent | d87715926049390a2417a2476742114ec966686a (diff) | |
download | libgit2-d08dd728a80eb993d80ec30d8c9f9025664c8990.tar.gz |
Merge pull request #1454 from libgit2/vmg/new-cache
New caching
Diffstat (limited to 'src/commit.c')
-rw-r--r-- | src/commit.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/commit.c b/src/commit.c index dd416920d..46c02c292 100644 --- a/src/commit.c +++ b/src/commit.c @@ -31,8 +31,10 @@ static void clear_parents(git_commit *commit) git_vector_clear(&commit->parent_ids); } -void git_commit__free(git_commit *commit) +void git_commit__free(void *_commit) { + git_commit *commit = _commit; + clear_parents(commit); git_vector_free(&commit->parent_ids); @@ -166,10 +168,11 @@ int git_commit_create( return retval; } -int git_commit__parse_buffer(git_commit *commit, const void *data, size_t len) +int git_commit__parse(void *_commit, git_odb_object *odb_obj) { - const char *buffer = data; - const char *buffer_end = (const char *)data + len; + git_commit *commit = _commit; + const char *buffer = git_odb_object_data(odb_obj); + const char *buffer_end = buffer + git_odb_object_size(odb_obj); git_oid parent_id; if (git_vector_init(&commit->parent_ids, 4, NULL) < 0) @@ -241,12 +244,6 @@ bad_buffer: return -1; } -int git_commit__parse(git_commit *commit, git_odb_object *obj) -{ - assert(commit); - return git_commit__parse_buffer(commit, obj->raw.data, obj->raw.len); -} - #define GIT_COMMIT_GETTER(_rvalue, _name, _return) \ _rvalue git_commit_##_name(const git_commit *commit) \ {\ |