TokTok / c-toxcore

The future of online communications.
https://tox.chat
GNU General Public License v3.0
2.21k stars 280 forks source link

cleanup: Small improvements found by PVS Studio. #2666

Closed iphydf closed 4 months ago

iphydf commented 4 months ago

This change is Reviewable

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (8201019) 73.11% compared to head (961891d) 73.02%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2666 +/- ## ========================================== - Coverage 73.11% 73.02% -0.09% ========================================== Files 148 148 Lines 30487 30482 -5 ========================================== - Hits 22292 22261 -31 - Misses 8195 8221 +26 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

iphydf commented 4 months ago

2048 is half a memory page, so it was a nice round number. I could make the assert check for tox max packet size instead, which is what we frequently stack-allocate everywhere, but there's no relationship between peer struct size and packet size, other than that both can be stack allocated.

nurupo commented 4 months ago

Um. Kindly pointing out that my questions weren't rhetorical :D