Page MenuHomeFreeBSD

tcp: style changes
ClosedPublic

Authored by rscheff on Jan 21 2024, 9:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 23, 8:34 AM
Unknown Object (File)
Sun, Jun 9, 8:16 AM
Unknown Object (File)
Sun, Jun 9, 8:16 AM
Unknown Object (File)
Sat, Jun 8, 7:28 PM
Unknown Object (File)
Sat, Jun 8, 7:28 PM
Unknown Object (File)
Sat, Jun 8, 7:27 PM
Unknown Object (File)
Sat, Jun 8, 7:21 PM
Unknown Object (File)
Sat, Jun 8, 7:17 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 Not Applicable
Unit
Tests Not Applicable

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
1885

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

SEQ_GEQ
    SEQ_SUB
sys/netinet/tcp_output.c
608

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
1885

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
1885

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
1885

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