builtin/fsck: convert remaining caller of get_sha1 to object_id
[gitweb.git] / commit.c
index 99846d9bf467be8e737341795054588475c65855..e0888cf0f7ac609f015c8bb2748b3b66d1a25e3a 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -199,11 +199,11 @@ static void prepare_commit_graft(void)
        commit_graft_prepared = 1;
 }
 
-struct commit_graft *lookup_commit_graft(const unsigned char *sha1)
+struct commit_graft *lookup_commit_graft(const struct object_id *oid)
 {
        int pos;
        prepare_commit_graft();
-       pos = commit_graft_pos(sha1);
+       pos = commit_graft_pos(oid->hash);
        if (pos < 0)
                return NULL;
        return commit_graft[pos];
@@ -287,8 +287,7 @@ void free_commit_buffer(struct commit *commit)
 {
        struct commit_buffer *v = buffer_slab_peek(&buffer_slab, commit);
        if (v) {
-               free(v->buffer);
-               v->buffer = NULL;
+               FREE_AND_NULL(v->buffer);
                v->size = 0;
        }
 }
@@ -336,7 +335,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
        bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
        pptr = &item->parents;
 
-       graft = lookup_commit_graft(item->object.oid.hash);
+       graft = lookup_commit_graft(&item->object.oid);
        while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
                struct commit *new_parent;