Page MenuHomeFreeBSD

tcp: style changes
ClosedPublic

Authored by rscheff on Jan 21 2024, 9:00 PM.
Tags
None
Referenced Files
F102678688: D43539.diff
Fri, Nov 15, 6:25 PM
Unknown Object (File)
Sat, Nov 9, 1:29 AM
Unknown Object (File)
Thu, Nov 7, 7:41 PM
Unknown Object (File)
Thu, Nov 7, 6:36 AM
Unknown Object (File)
Wed, Nov 6, 10:55 PM
Unknown Object (File)
Tue, Nov 5, 3:38 PM
Unknown Object (File)
Tue, Nov 5, 3:33 PM
Unknown Object (File)
Tue, Nov 5, 2:53 PM

Details

Summary

Break-out of the (mostly) pure style changes from D43470.

Non-style changes include the use of SEQ_SUB instead of
a plain subtraction, for an implict type conversion.

Using curly brackets in more or less deeply stacked if
statements throughout.

Split "} else if () {" with a newline to improve readabiliy:

} else
if () {

Evaluation order change in if condition and preventing
a theoretical overflow.

Use of the ? operator to enhance readability (clearing
of the FIN flag).

None of the above change the function.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 55549
Build 52438: arc lint + arc unit

Event Timeline

Please keep else if () in one line.

Split "} else if () {" with a newline to improve readabiliy

That's not an improvement. Nor is it consistent with style(9). Please don't do that.

  • undo splitting of } else if () {
This revision is now accepted and ready to land.Jan 22 2024, 11:34 AM
sys/netinet/tcp_input.c
1884

Add another level of alignment because SEQ_SUB is inside SEQ_GEQ. Like this:

SEQ_GEQ
    SEQ_SUB
sys/netinet/tcp_output.c
611

I am in favor of keeping this pair of "{}".

This revision now requires review to proceed.Jan 22 2024, 2:34 PM
rscheff added inline comments.
sys/netinet/tcp_input.c
1884

I'll indent it by a single additional space only, to be visually different from the statment in the if-clause. I have another change with a deep logcial stack of AND/ORed checks, which would end up way too far to the right if a half-tab (4 spaces) were used per bracket-level.

This revision is now accepted and ready to land.Jan 22 2024, 2:53 PM
sys/netinet/tcp_input.c
1884

Just observation: this isn't a stylistic change. However it seems safe since both predicates of OR dereference tp.

rscheff marked an inline comment as done.
  • make both conditional calls to tcp_output look similar
This revision now requires review to proceed.Jan 22 2024, 10:11 PM
sys/netinet/tcp_input.c
1884

Indeed; on closer examination, I should do a "sbavail() > SEQ_SUB(,), as the former is a uint, and the latter a int, which can not become larger than 2^30-2^14.

This revision is now accepted and ready to land.Jan 25 2024, 8:30 PM