Page MenuHomeFreeBSD

diff3: Code cleanup
ClosedPublic

Authored by des on Feb 25 2026, 8:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 30, 1:50 AM
Unknown Object (File)
Thu, Mar 26, 8:40 AM
Unknown Object (File)
Wed, Mar 25, 7:08 AM
Unknown Object (File)
Sat, Mar 21, 7:31 AM
Unknown Object (File)
Fri, Mar 20, 7:53 AM
Unknown Object (File)
Tue, Mar 17, 1:58 AM
Unknown Object (File)
Sat, Mar 14, 12:34 PM
Unknown Object (File)
Wed, Mar 11, 12:38 PM
Subscribers

Details

Summary
  • Order includes.
  • Turn the diff type into an enum.
  • Turn an unreachable error message into an assertion.
  • Remove unused debugging code.
  • Remove some dead assignments.
  • Consistently use 1 instead of EXIT_FAILURE.
  • Turn a return from main() into an exit().

MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71000
Build 67883: arc lint + arc unit

Event Timeline

des requested review of this revision.Feb 25 2026, 8:33 PM
usr.bin/diff3/diff3.c
875

Note that this is unreachable. Perhaps we should just assert that.

des retitled this revision from diff3: More consistent error handling to diff3: Code cleanup.Feb 25 2026, 9:09 PM
des edited the summary of this revision. (Show Details)
des edited the summary of this revision. (Show Details)
markj added inline comments.
usr.bin/diff3/diff3.c
91

Why introduce DIFF_NONE?

usr.bin/diff3/diff3.c
91

I don't want DIFF_TYPE1 to be 0 in case a bug lets an uninitialized struct diff through. Adding DIFF_NONE seemed cleaner than manually assigning values.

This revision is now accepted and ready to land.Feb 28 2026, 5:46 PM
This revision was automatically updated to reflect the committed changes.