Page MenuHomeFreeBSD

diff3: Code cleanup
ClosedPublic

Authored by des on Feb 25 2026, 8:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 4, 2:49 AM
Unknown Object (File)
Sun, Aug 2, 1:28 AM
Unknown Object (File)
Sat, Aug 1, 3:36 PM
Unknown Object (File)
Thu, Jul 30, 4:22 PM
Unknown Object (File)
Tue, Jul 28, 7:49 PM
Unknown Object (File)
Thu, Jul 23, 5:29 AM
Unknown Object (File)
Thu, Jul 23, 4:37 AM
Unknown Object (File)
Tue, Jul 21, 7:34 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.