Branch Coverage

deps/libgit2/src/util.c
Criterion Covered Total %
branch 110 284 38.7


line true false branch
40 2624 0 while (nptr_len && git__isspace(*p))
0 2624 while (nptr_len && git__isspace(*p))
43 0 2624 if (!nptr_len)
49 2615 9 if (*p == '-' || *p == '+') {
0 2615 if (*p == '-' || *p == '+') {
50 9 0 if (*p == '-')
56 0 2624 if (!nptr_len)
65 64 2560 if (base == 0) {
66 1 63 if (*p != '0')
68 0 63 else if (nptr_len > 2 && (p[1] == 'x' || p[1] == 'X'))
0 0 else if (nptr_len > 2 && (p[1] == 'x' || p[1] == 'X'))
0 0 else if (nptr_len > 2 && (p[1] == 'x' || p[1] == 'X'))
74 2624 0 if (base < 0 || 36 < base)
2624 0 if (base < 0 || 36 < base)
84 0 2624 if (base == 16 && nptr_len > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
0 0 if (base == 16 && nptr_len > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
0 0 if (base == 16 && nptr_len > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
0 0 if (base == 16 && nptr_len > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
0 0 if (base == 16 && nptr_len > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
92 12909 1784 for (; nptr_len > 0; p++,ndig++,nptr_len--) {
95 12069 840 if ('0'<=c && c<='9')
12069 0 if ('0'<=c && c<='9')
97 0 840 else if ('a'<=c && c<='z')
0 0 else if ('a'<=c && c<='z')
99 0 840 else if ('A'<=c && c<='Z')
0 0 else if ('A'<=c && c<='Z')
101 840 12069 if (v >= base)
103 9 12060 v = neg ? -v : v;
104 12069 0 if (n > INT64_MAX / base || n < INT64_MIN / base) {
0 12069 if (n > INT64_MAX / base || n < INT64_MIN / base) {
110 9078 2991 if ((v > 0 && nn > INT64_MAX - v) ||
9078 0 if ((v > 0 && nn > INT64_MAX - v) ||
9 12060 if ((v > 0 && nn > INT64_MAX - v) ||
111 0 9 (v < 0 && nn < INT64_MIN - v)) {
120 0 2624 if (ndig == 0) {
125 1484 1140 if (endptr)
128 0 2624 if (ovfl) {
144 0 836 if ((error = git__strntol64(&tmp_long, nptr, nptr_len, &tmp_endptr, base)) < 0)
148 0 836 if (tmp_int != tmp_long) {
155 836 0 if (endptr)
163 36 1 while (*a && *b && git__tolower(*a) == git__tolower(*b))
34 2 while (*a && *b && git__tolower(*a) == git__tolower(*b))
20 14 while (*a && *b && git__tolower(*a) == git__tolower(*b))
172 0 0 while (*a && *b) {
0 0 while (*a && *b) {
173 0 0 if (*a != *b) {
174 0 0 if (git__tolower(*a) != git__tolower(*b))
177 0 0 if (!cmp)
184 0 0 if (*a || *b)
0 0 if (*a || *b)
198 28 8 } while (--sz && al && al == bl);
28 0 } while (--sz && al && al == bl);
22 6 } while (--sz && al && al == bl);
207 0 0 for (i = 0; i < len; ++i) {
221 8304 1140 while (str_n--) {
225 0 8304 if (icase) {
230 178 8126 if (!p)
233 1528 6598 if (s != p)
248 6798 243772 if (!p)
251 5091 238681 if (s != p)
275 1185 1475 if (a < b)
284 0 0 while (*ptr && strchr(sep, *ptr))
0 0 while (*ptr && strchr(sep, *ptr))
287 0 0 if (*ptr) {
291 0 0 while (**end && !strchr(sep, **end))
0 0 while (**end && !strchr(sep, **end))
294 0 0 if (**end) {
310 0 0 while (*ptr && !strchr(sep, *ptr))
0 0 while (*ptr && !strchr(sep, *ptr))
313 0 0 if (*ptr) {
326 2830 205 return nl ? (size_t)(nl - buffer) + 1 : buffer_len;
338 0 0 if (needlelen > haystacklen || !haystacklen || !needlelen)
0 0 if (needlelen > haystacklen || !haystacklen || !needlelen)
0 0 if (needlelen > haystacklen || !haystacklen || !needlelen)
344 0 0 if (needlelen == 1)
347 0 0 if (n[0] == n[1]) {
356 0 0 while (j <= haystacklen - needlelen) {
357 0 0 if (n[1] != h[j + 1]) {
360 0 0 if (memcmp(n + 2, h + j + 2, needlelen - 2) == 0 &&
0 0 if (memcmp(n + 2, h + j + 2, needlelen - 2) == 0 &&
380 0 0 for (i = 0; i < line_count; ++i) {
384 0 0 for (j = 0; j < LINE_WIDTH; ++j, ++line) {
387 0 0 if (j == (LINE_WIDTH / 2))
394 0 0 for (j = 0; j < LINE_WIDTH; ++j, ++line)
395 0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
400 0 0 if (last_line > 0) {
404 0 0 for (j = 0; j < last_line; ++j, ++line) {
407 0 0 if (j == (LINE_WIDTH / 2))
411 0 0 if (j < (LINE_WIDTH / 2))
413 0 0 for (j = 0; j < (LINE_WIDTH - last_line); ++j)
419 0 0 for (j = 0; j < last_line; ++j, ++line)
420 0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
499 0 0 for (i = -nblocks; i; i++) {
567 4517 3347 for (lim = array_len; lim != 0; lim >>= 1) {
570 205 4312 if (cmp == 0) {
574 1185 3127 if (cmp > 0) { /* key > p; take right partition */
580 3549 3 if (position)
583 205 3347 return (cmp == 0) ? 0 : GIT_ENOTFOUND;
598 0 0 for (lim = array_len; lim != 0; lim >>= 1) {
601 0 0 if (cmp == 0) {
605 0 0 if (cmp > 0) { /* key > p; take right partition */
611 0 0 if (position)
614 0 0 return (cmp == 0) ? 0 : GIT_ENOTFOUND;
636 657 0 if (value == NULL ||
294 363 if (value == NULL ||
637 294 0 !strcasecmp(value, "true") ||
638 0 294 !strcasecmp(value, "yes") ||
643 14 280 if (!strcasecmp(value, "false") ||
14 0 if (!strcasecmp(value, "false") ||
644 14 0 !strcasecmp(value, "no") ||
645 0 14 !strcasecmp(value, "off") ||
658 0 32 if (!str)
661 141 32 for (scan = str; *scan; pos++, scan++) {
662 0 141 if (*scan == '\\' && *(scan + 1) != '\0')
0 0 if (*scan == '\\' && *(scan + 1) != '\0')
664 0 141 if (pos != scan)
668 0 32 if (pos != scan) {
697 4 4 while (elsize) {
714 50 22 for (i = base + elsize; i < end; i += elsize)
715 54 0 for (j = i; j > base && cmp(j, j - elsize, payload) < 0; j -= elsize)
4 50 for (j = i; j > base && cmp(j, j - elsize, payload) < 0; j -= elsize)
785 0 522 if (!length)
788 522 0 if (str_len > 0 && length > str_len)
0 522 if (str_len > 0 && length > str_len)
791 0 522 for (i = 1; i < length; i++) {
792 0 0 if ((str[i] & 0xC0) != 0x80)
806 0 0 if (length < 0)
815 0 0 if (uc < 0x80) uc = -1;
820 0 0 if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000) ||
0 0 if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000) ||
0 0 if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000) ||
0 0 if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000) ||
821 0 0 (uc >= 0xFDD0 && uc < 0xFDF0)) uc = -1;
826 0 0 if (uc < 0x10000 || uc >= 0x110000) uc = -1;
0 0 if (uc < 0x10000 || uc >= 0x110000) uc = -1;
830 0 0 if (uc < 0 || ((uc & 0xFFFF) >= 0xFFFE))
0 0 if (uc < 0 || ((uc & 0xFFFF) >= 0xFFFE))
841 522 38 while (offset < str_len) {
844 0 522 if (length < 0)
890 86 172 if (!val)