sha1_file: restore OBJECT_INFO_QUICK functionality
[gitweb.git] / builtin / unpack-objects.c
index 8bc9997767adbb77cc8af81b2b289e22f2b61c5a..62ea264c46783374d0f1968c19ea7581498a1f87 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;
@@ -394,7 +394,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
                lo = 0;
                hi = nr;
                while (lo < hi) {
-                       mid = (lo + hi)/2;
+                       mid = lo + (hi - lo) / 2;
                        if (base_offset < obj_list[mid].offset) {
                                hi = mid;
                        } else if (base_offset > obj_list[mid].offset) {