| 86 | } |
| 87 | |
| 88 | static void prepare_in_pack_by_idx(struct packing_data *pdata) |
| 89 | { |
| 90 | struct packed_git **mapping, *p; |
| 91 | int cnt = 0, nr = 1U << OE_IN_PACK_BITS; |
| 92 | |
| 93 | ALLOC_ARRAY(mapping, nr); |
| 94 | /* |
| 95 | * oe_in_pack() on an all-zero'd object_entry |
| 96 | * (i.e. in_pack_idx also zero) should return NULL. |
| 97 | */ |
| 98 | mapping[cnt++] = NULL; |
| 99 | repo_for_each_pack(pdata->repo, p) { |
| 100 | if (cnt == nr) { |
| 101 | free(mapping); |
| 102 | return; |
| 103 | } |
| 104 | p->index = cnt; |
| 105 | mapping[cnt++] = p; |
| 106 | } |
| 107 | pdata->in_pack_by_idx = mapping; |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * A new pack appears after prepare_in_pack_by_idx() has been |
no outgoing calls
no test coverage detected