lockfile: unlock file if lockfile permissions cannot be adjusted
[gitweb.git] / pack-objects.c
index 4f36c3204544c40ada8e6ce584deb6063b055518..6398a8aa96f2f44c0b01cf168619f1d269bc6dbb 100644 (file)
@@ -7,10 +7,9 @@ static uint32_t locate_object_entry_hash(struct packing_data *pdata,
                                         const unsigned char *sha1,
                                         int *found)
 {
-       uint32_t i, hash, mask = (pdata->index_size - 1);
+       uint32_t i, mask = (pdata->index_size - 1);
 
-       memcpy(&hash, sha1, sizeof(uint32_t));
-       i = hash & mask;
+       i = sha1hash(sha1) & mask;
 
        while (pdata->index[i] > 0) {
                uint32_t pos = pdata->index[i] - 1;
@@ -93,8 +92,7 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
 
        if (pdata->nr_objects >= pdata->nr_alloc) {
                pdata->nr_alloc = (pdata->nr_alloc  + 1024) * 3 / 2;
-               pdata->objects = xrealloc(pdata->objects,
-                                         pdata->nr_alloc * sizeof(*new_entry));
+               REALLOC_ARRAY(pdata->objects, pdata->nr_alloc);
        }
 
        new_entry = pdata->objects + pdata->nr_objects++;