Imported Upstream version 2.13.6
[platform/upstream/git.git] / pack-objects.c
index 4f36c32..6398a8a 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++;