quality: decompose receive_delta_file (236-line god function) #321

Closed
opened 2026-09-23 02:10:49 +02:00 by TapTap · 1 comment
Owner

src/shared/incremental_check.c:47-282 handles both delta-data and next branches plus signing/deserialization/decompression/metadata/xattr/size validation, with the trio free(old_data); delta_signature_destroy(sig); *failed = true; return NULL; repeated ~12x.

Work: introduce a fail: label doing common teardown (NULL-guarded), split the two branches into helpers, and drop the dead if (!old_data) check at 49-53.

`src/shared/incremental_check.c:47-282` handles both delta-data and next branches plus signing/deserialization/decompression/metadata/xattr/size validation, with the trio `free(old_data); delta_signature_destroy(sig); *failed = true; return NULL;` repeated ~12x. **Work:** introduce a `fail:` label doing common teardown (NULL-guarded), split the two branches into helpers, and drop the dead `if (!old_data)` check at 49-53.
TapTap added the qualitymemory labels 2026-09-23 02:10:49 +02:00
Author
Owner

Fixed in PR #329. receive_delta_file is now a 43-line dispatcher over receive_delta_data_branch/receive_next_branch, each with a NULL-guarded fail: teardown replacing the ~12 repeated cleanup blocks; the dead !old_data check was removed (and a missing basis guard restored in review). Behavior-preserving. Closing as completed.

Fixed in PR #329. `receive_delta_file` is now a 43-line dispatcher over `receive_delta_data_branch`/`receive_next_branch`, each with a NULL-guarded `fail:` teardown replacing the ~12 repeated cleanup blocks; the dead `!old_data` check was removed (and a missing basis guard restored in review). Behavior-preserving. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#321