MCPcopy Create free account
hub / github.com/git/git / count_trailing_blank

Function count_trailing_blank

diff.c:711–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711static 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
737static void check_blank_at_eof(mmfile_t *mf1, mmfile_t *mf2,
738 struct emit_callback *ecbdata)

Callers 1

check_blank_at_eofFunction · 0.85

Calls 1

ws_blank_lineFunction · 0.85

Tested by

no test coverage detected