Merge branch 'ks/branch-set-upstream' into next
[gitweb.git] / builtin / unpack-objects.c
index 3dc5e569186636fbb4bb9508f5915b8ab951ca32..689a29fac1a50df6e5b8fc3cda617ef1c6d060b3 100644 (file)
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "config.h"
 #include "object.h"
 #include "delta.h"
 #include "pack.h"
@@ -112,8 +113,7 @@ static void *get_data(unsigned long size)
                        break;
                if (ret != Z_OK) {
                        error("inflate returned %d", ret);
-                       free(buf);
-                       buf = NULL;
+                       FREE_AND_NULL(buf);
                        if (!recover)
                                exit(1);
                        has_errors = 1;
@@ -249,7 +249,7 @@ static void write_object(unsigned nr, enum object_type type,
                added_object(nr, type, buf, size);
                free(buf);
 
-               blob = lookup_blob(obj_list[nr].oid.hash);
+               blob = lookup_blob(&obj_list[nr].oid);
                if (blob)
                        blob->object.flags |= FLAG_WRITTEN;
                else
@@ -260,7 +260,8 @@ static void write_object(unsigned nr, enum object_type type,
                int eaten;
                hash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);
                added_object(nr, type, buf, size);
-               obj = parse_object_buffer(obj_list[nr].oid.hash, type, size, buf, &eaten);
+               obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
+                                         &eaten);
                if (!obj)
                        die("invalid %s", typename(type));
                add_object_buffer(obj, buf, size);