MCPcopy Index your code
hub / github.com/git/git / count_lines

Function count_lines

diff.c:658–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656};
657
658static 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
681static int fill_mmfile(struct repository *r, mmfile_t *mf,
682 struct diff_filespec *one)

Callers 3

check_blank_at_eofFunction · 0.85
emit_rewrite_diffFunction · 0.85
builtin_diffstatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected