myers_divide: stop traversing snakes after reasonable max effort

diff result: ensure sane order of result chunks Ensure that a adjacent chunks of same type are combined, and that a minus block always precedes an adjacent plus block. The upcoming myers-divide optimization is prone to produce weird ordering of plus and minus chunks.


patience: error handling from diff_atoms_same()

myers: error handling from diff_atoms_same()

add diff_atom_cmp() and error handling to diff_atom_same()

avoid include statements in header files; make each .c pull in what's needed

replace enum diff_rc errors with plain errno values

fix build with 'make PROFILE=1' on OpenBSD

fall back on file i/o in case an input file cannot be memory-mapped

move 'struct range' and related functions into the diff_ namespace no functional change

fix wrong assignment in diff_atoms_swallow_identical_neighbors; ok neels

KNF: use max 80 columns

KNF: function declaration return types on separate line

diff cmdline tool: allow using Patience by -p arg

fix myers divide: properly trigger division on single midpoints

add test012 test010 has a weird failure to find a good diff. This new test, when setting the permitted_state_size = 100, gives a shorter failure that test010, to allow easier debugging.

debug: myers divide: log nr of identical lines slid over

fix diff_algo_myers_divide's finding of midpoints When forwards and backwards traversals meet, the endpoints of the mid-snake are not the two points in kd_forward and kd_backward, but rather the section that was slid (if any) of the current forward/backward traversal only. For example: o-o-o | | o A | \ o o \ M |\ o o-o-o | | | o o X \ o \ o \ o The backward traversal reached M from the bottom and slid upwards. The forward traversal already reached X, which is not a straight line from M anymore, so picking a mid-snake from M to X would yield a mistake. The correct mid-snake is between M and A. M is where the bottom traversal hit the diagonal that the forwards traversal has already passed, and A is what it reaches when sliding up identical lines.

debug: myers graph dump tweaks In debug output: fix some indents, fix printing of max state size, in myers graph, limit x axis labels to 2 digits, print colored markers of current myers graph positions, also print myers-divide positions in myers graph.

comment tweak

remove code dup of diff_main() invocation for plain vs unidiff

add test010, test011

Only print (unified) header in unified format.

Remove unused `arbitrary_info'.