builtin/fsck: convert remaining caller of get_sha1 to object_id
[gitweb.git] / builtin / index-pack.c
index 04b9dcaf0f4ca90712cbb85cace521e226194f3b..26828c1d82bc9a997041cb464d4a3fde38e2d19d 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "config.h"
 #include "delta.h"
 #include "pack.h"
 #include "csum-file.h"
@@ -388,8 +389,7 @@ static struct base_data *alloc_base_data(void)
 static void free_base_data(struct base_data *c)
 {
        if (c->data) {
-               free(c->data);
-               c->data = NULL;
+               FREE_AND_NULL(c->data);
                get_thread_data()->base_cache_used -= c->size;
        }
 }
@@ -605,8 +605,7 @@ static void *unpack_data(struct object_entry *obj,
        git_inflate_end(&stream);
        free(inbuf);
        if (consume) {
-               free(data);
-               data = NULL;
+               FREE_AND_NULL(data);
        }
        return data;
 }
@@ -794,7 +793,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
 
        if (startup_info->have_repository) {
                read_lock();
-               collision_test_needed = has_sha1_file_with_flags(oid->hash, HAS_SHA1_QUICK);
+               collision_test_needed =
+                       has_sha1_file_with_flags(oid->hash, OBJECT_INFO_QUICK);
                read_unlock();
        }