| 709 | } |
| 710 | |
| 711 | static int count_trailing_blank(mmfile_t *mf) |
| 712 | { |
| 713 | char *ptr = mf->ptr; |
| 714 | long size = mf->size; |
| 715 | int cnt = 0; |
| 716 | |
| 717 | if (!size) |
| 718 | return cnt; |
| 719 | ptr += size - 1; /* pointing at the very end */ |
| 720 | if (*ptr != '\n') |
| 721 | ; /* incomplete line */ |
| 722 | else |
| 723 | ptr--; /* skip the last LF */ |
| 724 | while (mf->ptr < ptr) { |
| 725 | char *prev_eol; |
| 726 | for (prev_eol = ptr; mf->ptr <= prev_eol; prev_eol--) |
| 727 | if (*prev_eol == '\n') |
| 728 | break; |
| 729 | if (!ws_blank_line(prev_eol + 1, ptr - prev_eol)) |
| 730 | break; |
| 731 | cnt++; |
| 732 | ptr = prev_eol - 1; |
| 733 | } |
| 734 | return cnt; |
| 735 | } |
| 736 | |
| 737 | static void check_blank_at_eof(mmfile_t *mf1, mmfile_t *mf2, |
| 738 | struct emit_callback *ecbdata) |
no test coverage detected