Page MenuHomeFreeBSD

Use nitems and make few small clean ups.
ClosedPublic

Authored by araujo on Aug 12 2015, 12:28 PM.
Tags
None
Referenced Files
F135568759: D3366.diff
Mon, Nov 10, 10:01 PM
Unknown Object (File)
Thu, Oct 30, 1:37 AM
Unknown Object (File)
Thu, Oct 30, 1:37 AM
Unknown Object (File)
Thu, Oct 30, 1:37 AM
Unknown Object (File)
Thu, Oct 30, 1:37 AM
Unknown Object (File)
Wed, Oct 29, 5:40 PM
Unknown Object (File)
Thu, Oct 16, 4:59 AM
Unknown Object (File)
Mon, Oct 13, 6:35 AM
Subscribers

Details

Summary
  • Use nitems instead of "sizeof ypaliases/sizeof ypaliases[0]".
  • Prefer more expressive statement like: if (notrans == 0).
  • Also remove the brakets around !notrans inside the for().

Diff Detail

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

Event Timeline

araujo retitled this revision from to Use nitems and make few small clean ups..
araujo updated this object.
araujo edited the test plan for this revision. (Show Details)
araujo added reviewers: rodrigc, bapt, ed.
usr.bin/ypwhich/ypwhich.c
209 ↗(On Diff #7897)

This should also be notrans == 0 then as well, right?

But that said, in this case we only use notrans as a boolean. If you want, we could just #include <stdbool.h> and turn it into a bool. :-)

Address @ed suggestion, a little bit in a different way.

usr.bin/ypwhich/ypwhich.c
208–209 ↗(On Diff #7900)

In this case here, it could be changed to a bool. Other yp(8) tools use the same approach, but, I will add it in my todo list. I do believe it would be good maybe move notrans to a bool.

But I would like to do it in a next step.

bapt edited edge metadata.
This revision is now accepted and ready to land.Aug 12 2015, 1:59 PM
ed edited edge metadata.
usr.bin/ypwhich/ypwhich.c
172 ↗(On Diff #7900)

This doesn't look right. Can you check the logic here?

usr.bin/ypwhich/ypwhich.c
172 ↗(On Diff #7900)

Never mind, I read it wrong, this logic is right.

rodrigc edited edge metadata.