MCPcopy Create free account
hub / github.com/git/git / write_midx_oid_fanout

Function write_midx_oid_fanout

midx-write.c:507–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507static 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
536static int write_midx_oid_lookup(struct hashfile *f,
537 void *data)

Callers

nothing calls this directly

Calls 1

hashwrite_be32Function · 0.85

Tested by

no test coverage detected