Page MenuHomeFreeBSD

Fix usr.bin/sockstat/sockstat.c style(9)
ClosedPublic

Authored by garga on Feb 14 2017, 9:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 7:44 AM
Unknown Object (File)
Nov 11 2024, 10:56 AM
Unknown Object (File)
Nov 5 2024, 1:59 PM
Unknown Object (File)
Oct 2 2024, 2:51 AM
Unknown Object (File)
Oct 1 2024, 9:37 PM
Unknown Object (File)
Sep 26 2024, 8:06 AM
Unknown Object (File)
Sep 16 2024, 4:25 PM
Unknown Object (File)
Sep 9 2024, 8:34 PM
Subscribers

Details

Summary

While reading code in preparation to add libxo support, fix style(9)

Sponsored by: Rubicon Communications (Netgate)
MFC after: 1 week

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

garga retitled this revision from to Fix usr.bin/sockstat/sockstat.c style(9).
garga updated this object.
garga edited the test plan for this revision. (Show Details)
garga added reviewers: allanjude, loos, tuexen.
tuexen edited edge metadata.
This revision is now accepted and ready to land.Feb 15 2017, 4:20 PM
usr.bin/sockstat/sockstat.c
154 ↗(On Diff #25137)

style(9) was recently changed to permit the braces that were here. I personally prefer the braces, especially in cases like this, where the else has braces.

393 ↗(On Diff #25137)

I'm not sure if style(9) covers this. I think the prevailing style would put sizeof at the beginning of the next line. Personally, I would prefer that. Ditto three times below.

459 ↗(On Diff #25137)

I would prefer to separate the assignment and the comparison instead of wrapping the line, but this is fine.

504 ↗(On Diff #25137)

Ditto line 459.

1029 ↗(On Diff #25137)

I'm not sure that style(9) requires this. I personally prefer the old way.

garga edited edge metadata.

Improve as suggested by vangyzen@

This revision now requires review to proceed.Feb 15 2017, 5:15 PM
ngie added a reviewer: ngie.
ngie added a subscriber: ngie.
ngie added inline comments.
usr.bin/sockstat/sockstat.c
414 ↗(On Diff #25235)

(... vflag) != 0?

1029 ↗(On Diff #25137)

It does.

This revision is now accepted and ready to land.Feb 15 2017, 6:08 PM
usr.bin/sockstat/sockstat.c
459 ↗(On Diff #25137)

I should have been more clear. I'm sorry. I meant:

laddr = calloc(...);
if (laddr == NULL) {
garga edited edge metadata.

Separate assignment and comparison as suggested by vangyzen

This revision now requires review to proceed.Feb 15 2017, 6:28 PM
usr.bin/sockstat/sockstat.c
461 ↗(On Diff #25241)

err() call should point to "calloc()" here. There are other places I see the same issue. I'll submit a separate review

vangyzen edited edge metadata.
This revision is now accepted and ready to land.Feb 15 2017, 6:31 PM
allanjude edited edge metadata.

Approved By: allanjude

usr.bin/sockstat/sockstat.c
461 ↗(On Diff #25241)

calloc(num, size) is just a safe wrapper around malloc(num * size), so the error message is fine

This revision was automatically updated to reflect the committed changes.