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

Function block_iter_next

reftable/block.c:445–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445int block_iter_next(struct block_iter *it, struct reftable_record *rec)
446{
447 struct string_view in = {
448 .buf = (unsigned char *) it->block->block_data.data + it->next_off,
449 .len = it->block->restart_off - it->next_off,
450 };
451 struct string_view start = in;
452 uint8_t extra = 0;
453 int n = 0;
454
455 if (it->next_off >= it->block->restart_off)
456 return 1;
457
458 n = reftable_decode_key(&it->last_key, &extra, in);
459 if (n < 0)
460 return -1;
461 if (!it->last_key.len)
462 return REFTABLE_FORMAT_ERROR;
463
464 string_view_consume(&in, n);
465 n = reftable_record_decode(rec, it->last_key, extra, in, it->block->hash_size,
466 &it->scratch);
467 if (n < 0)
468 return -1;
469 string_view_consume(&in, n);
470
471 it->next_off += start.len - in.len;
472 return 0;
473}
474
475void block_iter_reset(struct block_iter *it)
476{

Calls 3

reftable_decode_keyFunction · 0.85
string_view_consumeFunction · 0.85
reftable_record_decodeFunction · 0.85