| 41 | } |
| 42 | |
| 43 | static void rehash_objects(struct packing_data *pdata) |
| 44 | { |
| 45 | uint32_t i; |
| 46 | struct object_entry *entry; |
| 47 | |
| 48 | pdata->index_size = closest_pow2(pdata->nr_objects * 3); |
| 49 | if (pdata->index_size < 1024) |
| 50 | pdata->index_size = 1024; |
| 51 | |
| 52 | free(pdata->index); |
| 53 | CALLOC_ARRAY(pdata->index, pdata->index_size); |
| 54 | |
| 55 | entry = pdata->objects; |
| 56 | |
| 57 | for (i = 0; i < pdata->nr_objects; i++) { |
| 58 | int found; |
| 59 | uint32_t ix = locate_object_entry_hash(pdata, |
| 60 | &entry->idx.oid, |
| 61 | &found); |
| 62 | |
| 63 | if (found) |
| 64 | BUG("Duplicate object in hash"); |
| 65 | |
| 66 | pdata->index[ix] = i + 1; |
| 67 | entry++; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | struct object_entry *packlist_find(struct packing_data *pdata, |
| 72 | const struct object_id *oid) |
no test coverage detected