change: deduplicate some code repetition
Dependencies
- [2]
WFA5BBRFFix warnings - [3]
2U7P5SFQChange struct names "struct foo -> typedef struct Foo" - [4]
KEC3WLFNchange: remove debugging lines - [5]
FMYCPGKDchange: extract hash list decoding into reused function - [6]
ZKAOPMCHchange: Implement decoding of edits, atoms, positions, among others - [7]
JAGXXSR7change: initial work on decoding hunks - [*]
Q7TKZCJPAdd initial support for reading the offsets from a (fixed) change - [*]
RIWSVVASchange: decompress the 'contents' with zstd_seekable - [*]
OBKF6SIIchange: decompress the hashed section too
Change contents
- edit in change.c at line 151[10.2591][11.1065]
}static voidchange_readhash(Bincode *binstat, uint8_t *dest, uint8_t variant){switch (variant) {case HASH_BLAKE3:bincode_getbytes(binstat, dest, BLAKE3_BYTES);break;case HASH_NONE:/* Do nothing - no bytes to consume */break;default:die("unknown hash variant: %u", variant);} - replacement in change.c at line 180[2.129]→[3.311:371](∅→∅),[3.311]→[3.311:371](∅→∅),[3.371]→[3.989:1068](∅→∅),[3.1068]→[3.514:583](∅→∅),[3.514]→[3.514:583](∅→∅),[3.583]→[3.2209:2246](∅→∅)
switch (target->entries[i].variant) {case HASH_BLAKE3:bincode_getbytes(binstat, target->entries[i].bytes, BLAKE3_BYTES);break;case HASH_NONE:/* Do nothing, no bytes to consume */break;default:abort();}change_readhash(binstat, target->entries[i].bytes,target->entries[i].variant); - replacement in change.c at line 192[3.1196]→[3.1196:1347](∅→∅),[3.1347]→[3.2509:2537](∅→∅),[3.2509]→[3.2509:2537](∅→∅),[3.2537]→[3.1348:1375](∅→∅)
switch (pos->change.variant) {case HASH_BLAKE3:bincode_getbytes(binstat, (uint8_t *)&pos->change.bytes,BLAKE3_BYTES);break;case HASH_NONE:break;default:abort();}change_readhash(binstat, (uint8_t *)&pos->change.bytes,pos->change.variant); - replacement in change.c at line 210[3.1626]→[3.1626:1653](∅→∅),[3.1653]→[3.2537:2578](∅→∅),[3.2537]→[3.2537:2578](∅→∅),[3.2578]→[3.1654:1704](∅→∅),[3.1704]→[3.2627:2643](∅→∅),[3.2627]→[3.2627:2643](∅→∅),[3.2643]→[3.1705:1733](∅→∅),[3.1733]→[3.2643:2670](∅→∅),[3.2643]→[3.2643:2670](∅→∅)
switch (hash->variant) {case HASH_BLAKE3:bincode_getbytes(binstat, (uint8_t *)hash->bytes, BLAKE3_BYTES);break;case HASH_NONE:break;default:abort();}change_readhash(binstat, (uint8_t *)hash->bytes, hash->variant); - replacement in change.c at line 224
switch (hash->variant) {case HASH_BLAKE3:bincode_getbytes(binstat, (uint8_t *)hash->bytes, BLAKE3_BYTES);break;case HASH_NONE:break;default:abort();}change_readhash(binstat, (uint8_t *)hash->bytes, hash->variant); - edit in change.c at line 227