smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.64k stars 404 forks source link

chore(wire): add check_len to all parse methods #885

Closed thvdveld closed 6 months ago

thvdveld commented 6 months ago

This commit adds a call to check_len to all parse methods in the wire module. This ensures that no accessor methods are invalid, helping the compiler optimise.

server: 199.4KiB -> 197.3KiB client: 200.2KiB -> 198.0KiB sixlowpan: 196.8KiB -> 194.7KiB

It's a small gain, but it's worth it.

Edit: valid -> invalid

codecov[bot] commented 6 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (3f2a219) 79.77% compared to head (892d4d9) 79.71%.

Files Patch % Lines
src/wire/ethernet.rs 0.00% 1 Missing :warning:
src/wire/sixlowpan/frag.rs 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #885 +/- ## ========================================== - Coverage 79.77% 79.71% -0.06% ========================================== Files 78 78 Lines 28133 28060 -73 ========================================== - Hits 22443 22369 -74 - Misses 5690 5691 +1 ```

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

crawford commented 6 months ago

This ensures that no accessor methods are valid…

“Invalid”?

thvdveld commented 6 months ago

Oh damn, yes, that's what I wanted to write...