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
Unknown Object (File)
Feb 28 2024, 10:49 AM
Unknown Object (File)
Feb 28 2024, 9:03 AM
Unknown Object (File)
Dec 29 2023, 4:27 PM
Unknown Object (File)
Jun 17 2023, 12:31 PM
Unknown Object (File)
May 23 2023, 11:44 PM
Unknown Object (File)
Apr 26 2023, 4:18 AM
Unknown Object (File)
Apr 8 2023, 10:51 AM
Unknown Object (File)
Dec 8 2016, 9: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.