Mercurial > public > ostc4
comparison Discovery/Src/test_vpm.c @ 269:6e78137952af write-from-sim
cleanup: do not pass large struct by value
Passing a huge struct by value is poor practice. Simply pass it by reference.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Tue, 23 Apr 2019 21:03:24 +0200 |
parents | f9b17e898a7a |
children | 54d14bc2083c |
comparison
equal
deleted
inserted
replaced
268:1b9847d40e81 | 269:6e78137952af |
---|---|
525 else | 525 else |
526 { | 526 { |
527 input.events.gasChange = 0; | 527 input.events.gasChange = 0; |
528 input.events.info_GasChange = 0; | 528 input.events.info_GasChange = 0; |
529 } | 529 } |
530 logbook_writeSample(input); | 530 logbook_writeSample(&input); |
531 } | 531 } |
532 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); | 532 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); |
533 | 533 |
534 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; | 534 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; |
535 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; | 535 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; |
588 else | 588 else |
589 { | 589 { |
590 input.events.gasChange = 0; | 590 input.events.gasChange = 0; |
591 input.events.info_GasChange = 0; | 591 input.events.info_GasChange = 0; |
592 } | 592 } |
593 logbook_writeSample(input); | 593 logbook_writeSample(&input); |
594 } | 594 } |
595 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); | 595 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); |
596 | 596 |
597 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; | 597 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; |
598 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; | 598 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; |
650 else | 650 else |
651 { | 651 { |
652 input.events.gasChange = 0; | 652 input.events.gasChange = 0; |
653 input.events.info_GasChange = 0; | 653 input.events.info_GasChange = 0; |
654 } | 654 } |
655 logbook_writeSample(input); | 655 logbook_writeSample(&input); |
656 } | 656 } |
657 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); | 657 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); |
658 | 658 |
659 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; | 659 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; |
660 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; | 660 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; |
706 input.lifeData.depth_meter -= ascendrate_seconds; | 706 input.lifeData.depth_meter -= ascendrate_seconds; |
707 if(input.lifeData.depth_meter < 0) | 707 if(input.lifeData.depth_meter < 0) |
708 input.lifeData.depth_meter = 0; | 708 input.lifeData.depth_meter = 0; |
709 } | 709 } |
710 | 710 |
711 logbook_writeSample(input); | 711 logbook_writeSample(&input); |
712 } | 712 } |
713 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); | 713 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader(); |
714 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; | 714 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds; |
715 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; | 715 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100; |
716 logbook_EndDive(); | 716 logbook_EndDive(); |