| 580 | to be the "change". */ |
| 581 | |
| 582 | void GnuDiff::shift_boundaries(file_data filevec[]) |
| 583 | { |
| 584 | qint32 f; |
| 585 | |
| 586 | for(f = 0; f < 2; ++f) |
| 587 | { |
| 588 | bool *changed = filevec[f].changed; |
| 589 | bool const *other_changed = filevec[1 - f].changed; |
| 590 | GNULineRef const *equivs = filevec[f].equivs; |
| 591 | GNULineRef i = 0; |
| 592 | GNULineRef j = 0; |
| 593 | GNULineRef i_end = filevec[f].buffered_lines; |
| 594 | |
| 595 | while(true) |
| 596 | { |
| 597 | GNULineRef runlength, start, corresponding; |
| 598 | |
| 599 | /* Scan forwards to find beginning of another run of changes. |
| 600 | Also keep track of the corresponding point in the other file. */ |
| 601 | |
| 602 | while(i < i_end && !changed[i]) |
| 603 | { |
| 604 | while(other_changed[j++]) |
| 605 | continue; |
| 606 | i++; |
| 607 | } |
| 608 | |
| 609 | if(i == i_end) |
| 610 | break; |
| 611 | |
| 612 | start = i; |
| 613 | |
| 614 | /* Find the end of this run of changes. */ |
| 615 | |
| 616 | while(changed[++i]) |
| 617 | continue; |
| 618 | while(other_changed[j]) |
| 619 | j++; |
| 620 | |
| 621 | do |
| 622 | { |
| 623 | /* Record the length of this run of changes, so that |
| 624 | we can later determine whether the run has grown. */ |
| 625 | runlength = i - start; |
| 626 | |
| 627 | /* Move the changed region back, so long as the |
| 628 | previous unchanged line matches the last changed one. |
| 629 | This merges with previous changed regions. */ |
| 630 | |
| 631 | while(start && equivs[start - 1] == equivs[i - 1]) |
| 632 | { |
| 633 | changed[--start] = true; |
| 634 | changed[--i] = false; |
| 635 | while(changed[start - 1]) |
| 636 | start--; |
| 637 | while(other_changed[--j]) |
| 638 | continue; |
| 639 | } |
nothing calls this directly
no outgoing calls
no test coverage detected