| 656 | }; |
| 657 | |
| 658 | static int count_lines(const char *data, int size) |
| 659 | { |
| 660 | int count, ch, completely_empty = 1, nl_just_seen = 0; |
| 661 | count = 0; |
| 662 | while (0 < size--) { |
| 663 | ch = *data++; |
| 664 | if (ch == '\n') { |
| 665 | count++; |
| 666 | nl_just_seen = 1; |
| 667 | completely_empty = 0; |
| 668 | } |
| 669 | else { |
| 670 | nl_just_seen = 0; |
| 671 | completely_empty = 0; |
| 672 | } |
| 673 | } |
| 674 | if (completely_empty) |
| 675 | return 0; |
| 676 | if (!nl_just_seen) |
| 677 | count++; /* no trailing newline */ |
| 678 | return count; |
| 679 | } |
| 680 | |
| 681 | static int fill_mmfile(struct repository *r, mmfile_t *mf, |
| 682 | struct diff_filespec *one) |
no outgoing calls
no test coverage detected