Commit 6e17be0
committed
task_save_handler improvements:
1. Division by zero: early return when size <= 0 or data is NULL, avoiding the divide and handling the degenerate case cleanly
2. Separated cancellation from write failure: cancel just cleans up silently, write failure still reports the error — these are different situations
3. Eliminated unnecessary allocations: the old code did strdup into msg, then conditionally passed it to task_set_title, then freed it if unused. Now strdup only happens inside the !MUTE branch, so every allocation is consumed by task_set_title directly
4. Stack buffers scoped tighter: char msg[128] only lives in the blocks that need it, not across the whole trailing portion of the function
5. Removed dead write path: the old code skipped the intfstream_write when data was NULL but still checked written != remaining, which would always trigger the error path with written=0. Now that case is handled by the early return1 parent 9dc9d16 commit 6e17be0
1 file changed
+38
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
522 | 521 | | |
523 | 522 | | |
524 | 523 | | |
| |||
530 | 529 | | |
531 | 530 | | |
532 | 531 | | |
533 | | - | |
534 | | - | |
535 | | - | |
| 532 | + | |
| 533 | + | |
536 | 534 | | |
537 | | - | |
538 | | - | |
539 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
540 | 538 | | |
541 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
542 | 545 | | |
543 | 546 | | |
544 | 547 | | |
545 | 548 | | |
546 | | - | |
| 549 | + | |
547 | 550 | | |
548 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
549 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
550 | 560 | | |
551 | 561 | | |
552 | 562 | | |
| |||
564 | 574 | | |
565 | 575 | | |
566 | 576 | | |
567 | | - | |
568 | 577 | | |
569 | 578 | | |
| 579 | + | |
570 | 580 | | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
575 | 585 | | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 586 | + | |
591 | 587 | | |
592 | | - | |
593 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
594 | 602 | | |
595 | | - | |
596 | 603 | | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | 604 | | |
601 | 605 | | |
602 | 606 | | |
| |||
0 commit comments