refactor excessively long functions
For readability's sake, we should refactor functions so that they're reasonably short. The screen size is ~80 lines, some functions are >300 lines, which makes it easier to make mistakes. The !432 (merged) added an upper bound limit of 400 statements / 500 lines, but we should do better. These functions exceed the 200 statements / 300 lines limit:
- layer/validate.c:824 function 'validate' 337 statements (threshold 200)
- resolve.c:1310 function 'kr_resolve_produce' 250 statements (threshold 200)
- worker.c:1406 function 'qr_task_step' 221 statements (threshold 200)
- worker.c:1872 function 'worker_process_tcp' 260 statements (threshold 200)
- main.c:425 function 'main' 247 statements (threshold 200)