Page MenuHomeFreeBSD

ftw.3: Add examples

Authored by 0mp on Sep 22 2019, 12:31 PM.

Diff Detail

rS FreeBSD src repository
Lint OK
No Unit Test Coverage
Build Status
Buildable 29720
Build 27562: arc lint + arc unit

Event Timeline

0mp created this revision.Sep 22 2019, 12:31 PM

The description of what it does makes sense, although I can't spot if that's actually what the code does.
Otherwise, LGTM.

jilles added a subscriber: jilles.Sep 22 2019, 1:41 PM
jilles added inline comments.

Given that POSIX.1-2008tc2 says that ftw() is obsolete and applications should use nftw() instead, it seems better to have the example use nftw() instead.


can be used.


Not having a default in this switch feels somewhat uncomfortable, especially because POSIX says FTW_SL is a valid value here.

0mp planned changes to this revision.Feb 1 2020, 10:26 AM
0mp updated this revision to Diff 67710.Feb 3 2020, 4:29 PM

Use nftw instead of ftw

0mp marked 3 inline comments as done.Feb 3 2020, 4:31 PM

The example now uses nftw() instead of ftw().

Is is ready now?


Great idea! Thanks!




I've included all the types now into the switch.

0mp marked 3 inline comments as done.Feb 4 2020, 8:50 AM
jilles added inline comments.Feb 4 2020, 11:02 PM

Especially for example code it would be better to have defined behaviour for all values of typeflag. Consider that people might copy and paste.

0mp added inline comments.Feb 12 2020, 1:11 PM

@jilles, Hmmm, the example now has a case statement for every possible value of typeflag. I think I don't understand your comment. Am I missing something?

jilles added inline comments.Feb 12 2020, 10:51 PM

Paranoia in case the code is edited to remove cases or to add a flag (that does not exist yet) requesting a new typeflag value. Initializing type or adding a default would avoid that.

0mp planned changes to this revision.Feb 18 2020, 11:35 AM
0mp updated this revision to Diff 69060.Mar 2 2020, 10:43 AM

Add a default case to the switch statement

jilles accepted this revision.Mar 4 2020, 9:06 PM
This revision is now accepted and ready to land.Mar 4 2020, 9:06 PM
bcr accepted this revision.Mar 5 2020, 9:52 AM
This revision was automatically updated to reflect the committed changes.