Branch Coverage

deps/libgit2/src/buf_text.c
Criterion Covered Total %
branch 70 142 49.3


line true false branch
18 0 3 if (!string)
21 6 3 for (scan = string; *scan; ) {
32 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1);
33 0 3 if (git_buf_grow_by(buf, alloclen) < 0)
36 6 3 for (scan = string; *scan; ) {
43 3 6 for (count = strspn(scan, esc_chars); count > 0; --count) {
72 0 3 assert(tgt != src);
74 0 3 if (!next)
78 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
79 0 3 if (git_buf_grow(tgt, new_size) < 0)
86 3 3 for (; next; scan = next + 1, next = memchr(scan, '\r', scan_end - scan)) {
87 3 0 if (next > scan) {
94 3 0 if (next + 1 == scan_end || next[1] != '\n')
0 3 if (next + 1 == scan_end || next[1] != '\n')
99 3 0 if (scan < scan_end) {
119 0 3 assert(tgt != src);
121 0 3 if (!next)
125 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
126 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
127 0 3 if (git_buf_grow(tgt, alloclen) < 0)
131 3 3 for (; next; scan = next + 1, next = memchr(scan, '\n', end - scan)) {
135 3 0 if (copylen && next[-1] == '\r')
0 3 if (copylen && next[-1] == '\r')
138 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
139 0 3 if (git_buf_grow_by(tgt, alloclen) < 0)
142 3 0 if (copylen) {
162 36 0 if (!strings || !strings->count)
0 36 if (!strings || !strings->count)
166 0 36 if (git_buf_sets(buf, strings->strings[0]) < 0)
170 3 33 for (i = 1; i < strings->count; ++i) {
172 3 0 for (str = strings->strings[i], pfx = buf->ptr;
173 0 3 *str && *str == *pfx; str++, pfx++)
178 3 0 if (!buf->size)
193 0 10 if (bom > GIT_BOM_UTF8)
196 279 10 while (scan < end) {
202 276 3 if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014')
0 276 if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014')
3 0 if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014')
3 0 if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014')
0 3 if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014')
204 0 3 else if (c == '\0')
206 0 3 else if (!git__isspace(c))
225 2494 261 if (buf->size < 2)
233 0 0 if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') {
0 0 if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') {
0 0 if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') {
0 0 if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') {
239 0 0 if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') {
0 0 if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') {
0 0 if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') {
245 0 0 if (*ptr == '\xFF') {
251 0 0 if (*ptr != '\xFE')
253 0 0 if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) {
0 0 if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) {
0 0 if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) {
278 0 63 if (skip_bom)
282 63 0 if (buf->size > 0 && end[-1] == '\032')
0 63 if (buf->size > 0 && end[-1] == '\032')
286 1940 63 while (scan < end) {
289 1889 51 if (c > 0x1F && c != 0x7F)
1889 0 if (c > 0x1F && c != 0x7F)
301 3 0 if (scan < end && *scan == '\n')
3 0 if (scan < end && *scan == '\n')
314 63 0 return (stats->cr != stats->crlf || stats->nul > 0 ||
63 0 return (stats->cr != stats->crlf || stats->nul > 0 ||
0 63 return (stats->cr != stats->crlf || stats->nul > 0 ||