summaryrefslogtreecommitdiff
path: root/src/commit_list.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-10 17:10:17 -0700
committerVicent Marti <tanoku@gmail.com>2013-04-22 16:50:51 +0200
commitbadd85a61354ef7b62c5f8e53d740738e5ef1e57 (patch)
tree553f006c1b237de2a57ad6416e80db4ac8e6cf1a /src/commit_list.c
parentee12272d170d6a9d60f13d6de6129f56bfb2fbf6 (diff)
downloadlibgit2-badd85a61354ef7b62c5f8e53d740738e5ef1e57.tar.gz
Use git_odb_object_data/_size whereever possible
This uses the odb object accessors so we can change the internals more easily...
Diffstat (limited to 'src/commit_list.c')
-rw-r--r--src/commit_list.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/commit_list.c b/src/commit_list.c
index baabbbafb..bd5b5201a 100644
--- a/src/commit_list.c
+++ b/src/commit_list.c
@@ -103,12 +103,12 @@ git_commit_list_node *git_commit_list_pop(git_commit_list **stack)
static int commit_quick_parse(
git_revwalk *walk,
git_commit_list_node *commit,
- uint8_t *buffer,
+ const uint8_t *buffer,
size_t buffer_len)
{
const size_t parent_len = strlen("parent ") + GIT_OID_HEXSZ + 1;
- uint8_t *buffer_end = buffer + buffer_len;
- uint8_t *parents_start, *committer_start;
+ const uint8_t *buffer_end = buffer + buffer_len;
+ const uint8_t *parents_start, *committer_start;
int i, parents = 0;
int commit_time;
@@ -127,7 +127,7 @@ static int commit_quick_parse(
for (i = 0; i < parents; ++i) {
git_oid oid;
- if (git_oid_fromstr(&oid, (char *)buffer + strlen("parent ")) < 0)
+ if (git_oid_fromstr(&oid, (const char *)buffer + strlen("parent ")) < 0)
return -1;
commit->parents[i] = git_revwalk__commit_lookup(walk, &oid);
@@ -189,7 +189,10 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
giterr_set(GITERR_INVALID, "Object is no commit object");
error = -1;
} else
- error = commit_quick_parse(walk, commit, obj->buffer, obj->cached.size);
+ error = commit_quick_parse(
+ walk, commit,
+ (const uint8_t *)git_odb_object_data(obj),
+ git_odb_object_size(obj));
git_odb_object_free(obj);
return error;