Page MenuHomeFreeBSD

ftw.3: Add examples
ClosedPublic

Authored by 0mp on Sep 22 2019, 12:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 28, 10:33 AM
Unknown Object (File)
Tue, Mar 19, 4:17 AM
Unknown Object (File)
Tue, Mar 19, 2:56 AM
Unknown Object (File)
Feb 12 2024, 10:41 PM
Unknown Object (File)
Feb 9 2024, 6:14 AM
Unknown Object (File)
Feb 9 2024, 6:13 AM
Unknown Object (File)
Jan 13 2024, 3:22 AM
Unknown Object (File)
Dec 23 2023, 2:13 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29133
Build 27069: arc lint + arc unit

Event Timeline

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 inline comments.
lib/libc/gen/ftw.3
162

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.

163

can be used.

189

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

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?

lib/libc/gen/ftw.3
162

Great idea! Thanks!

163

Done!

189

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

0mp marked 3 inline comments as done.Feb 4 2020, 8:50 AM
lib/libc/gen/ftw.3
189

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

lib/libc/gen/ftw.3
189

@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?

lib/libc/gen/ftw.3
189

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

Add a default case to the switch statement

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