| 505 | } |
| 506 | |
| 507 | static int write_midx_oid_fanout(struct hashfile *f, |
| 508 | void *data) |
| 509 | { |
| 510 | struct write_midx_context *ctx = data; |
| 511 | struct pack_midx_entry *list = ctx->entries; |
| 512 | struct pack_midx_entry *last = ctx->entries + ctx->entries_nr; |
| 513 | uint32_t count = 0; |
| 514 | uint32_t i; |
| 515 | |
| 516 | /* |
| 517 | * Write the first-level table (the list is sorted, |
| 518 | * but we use a 256-entry lookup to be able to avoid |
| 519 | * having to do eight extra binary search iterations). |
| 520 | */ |
| 521 | for (i = 0; i < 256; i++) { |
| 522 | struct pack_midx_entry *next = list; |
| 523 | |
| 524 | while (next < last && next->oid.hash[0] == i) { |
| 525 | count++; |
| 526 | next++; |
| 527 | } |
| 528 | |
| 529 | hashwrite_be32(f, count); |
| 530 | list = next; |
| 531 | } |
| 532 | |
| 533 | return 0; |
| 534 | } |
| 535 | |
| 536 | static int write_midx_oid_lookup(struct hashfile *f, |
| 537 | void *data) |
nothing calls this directly
no test coverage detected