Page MenuHomeFreeBSD

cr_bsd_visible(): Style fix: Explicitly test for non-zero return codes
ClosedPublic

Authored by olce on Jan 5 2024, 5:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 13, 2:59 PM
Unknown Object (File)
Mon, Oct 13, 2:58 PM
Unknown Object (File)
Mon, Oct 13, 2:58 PM
Unknown Object (File)
Mon, Oct 13, 2:05 AM
Unknown Object (File)
Thu, Oct 9, 7:58 PM
Unknown Object (File)
Sep 12 2025, 3:41 PM
Unknown Object (File)
Aug 15 2025, 8:00 PM
Unknown Object (File)
Aug 10 2025, 8:16 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Jan 5 2024, 5:02 PM
This revision is now accepted and ready to land.Jan 6 2024, 1:23 AM

jhb@ prefers such code to be written as

error = XXX();
if (error != 0)
   return (error);

jhb@ prefers such code to be written as

IMO that is indeed clearer.

jhb@ prefers such code to be written as

IMO that is indeed clearer.

For me it's a minor point, but I prefer to write things like:

if ((error = XXX) != 0)

when that fits on a single line, because I find C too verbose on this occasion: It cannot express very concisely to return from the current function with a given value if it is non-zero, without using macros. I wish we could settle on a "global", well-known macro to do exactly that.

Now, if you all prefer a separate line, of course I'll adopt that convention.

I will adapt the code above to this end at commit time.

This revision was automatically updated to reflect the committed changes.