MCPcopy Create free account
hub / github.com/KDE/kdiff3 / build_script

Method build_script

src/gnudiff_analyze.cpp:736–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734 producing an edit script in forward order. */
735
736GnuDiff::change *GnuDiff::build_script(file_data const filevec[])
737{
738 change *script = nullptr;
739 bool *changed0 = filevec[0].changed;
740 bool *changed1 = filevec[1].changed;
741 GNULineRef i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines;
742
743 /* Note that changedN[-1] does exist, and is 0. */
744
745 while(i0 >= 0 || i1 >= 0)
746 {
747 if(changed0[i0 - 1] | changed1[i1 - 1])
748 {
749 GNULineRef line0 = i0, line1 = i1;
750
751 /* Find # lines changed here in each file. */
752 while(changed0[i0 - 1]) --i0;
753 while(changed1[i1 - 1]) --i1;
754
755 /* Record this change. */
756 script = add_change(i0, i1, line0 - i0, line1 - i1, script);
757 }
758
759 /* We have reached lines in the two files that match each other. */
760 i0--, i1--;
761 }
762
763 return script;
764}
765
766/* Report the differences of two files. */
767GnuDiff::change *GnuDiff::diff_2_files(comparison *cmp)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected