Branch Coverage

deps/libgit2/src/util/util.c
Criterion Covered Total %
branch 102 242 42.1


line true false branch
49 2614 0 while (nptr_len && git__isspace(*p))
0 2614 while (nptr_len && git__isspace(*p))
52 0 2614 if (!nptr_len)
58 2605 9 if (*p == '-' || *p == '+') {
0 2605 if (*p == '-' || *p == '+') {
59 9 0 if (*p == '-')
65 0 2614 if (!nptr_len)
74 78 2536 if (base == 0) {
75 15 63 if (*p != '0')
77 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'))
83 2614 0 if (base < 0 || 36 < base)
2614 0 if (base < 0 || 36 < base)
93 0 2614 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')) {
101 12803 1766 for (; nptr_len > 0; p++,ndig++,nptr_len--) {
104 11969 834 if ('0'<=c && c<='9')
11955 14 if ('0'<=c && c<='9')
106 14 834 else if ('a'<=c && c<='z')
14 0 else if ('a'<=c && c<='z')
108 0 834 else if ('A'<=c && c<='Z')
0 0 else if ('A'<=c && c<='Z')
110 848 11955 if (v >= base)
112 9 11946 v = neg ? -v : v;
113 11955 0 if (git__multiply_int64_overflow(&nn, n, base) || git__add_int64_overflow(&n, nn, v)) {
0 11955 if (git__multiply_int64_overflow(&nn, n, base) || git__add_int64_overflow(&n, nn, v)) {
121 14 2600 if (ndig == 0) {
126 1472 1128 if (endptr)
129 0 2600 if (ovfl) {
145 0 830 if ((error = git__strntol64(&tmp_long, nptr, nptr_len, &tmp_endptr, base)) < 0)
149 0 830 if (tmp_int != tmp_long) {
156 830 0 if (endptr)
164 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))
173 0 0 while (*a && *b) {
0 0 while (*a && *b) {
174 0 0 if (*a != *b) {
175 0 0 if (git__tolower(*a) != git__tolower(*b))
178 0 0 if (!cmp)
185 0 0 if (*a || *b)
0 0 if (*a || *b)
199 28 8 } while (--sz && al && al == bl);
28 0 } while (--sz && al && al == bl);
22 6 } while (--sz && al && al == bl);
208 0 0 for (i = 0; i < len; ++i) {
222 8235 1128 while (str_n--) {
226 0 8235 if (icase) {
231 178 8057 if (!p)
234 1519 6538 if (s != p)
249 6660 238124 if (!p)
252 5093 233031 if (s != p)
276 1145 1425 if (a < b)
285 0 0 while (*ptr && strchr(sep, *ptr))
0 0 while (*ptr && strchr(sep, *ptr))
288 0 0 if (*ptr) {
292 0 0 while (**end && !strchr(sep, **end))
0 0 while (**end && !strchr(sep, **end))
295 0 0 if (**end) {
311 0 0 while (*ptr && !strchr(sep, *ptr))
0 0 while (*ptr && !strchr(sep, *ptr))
314 0 0 if (*ptr) {
327 2970 276 return nl ? (size_t)(nl - buffer) + 1 : buffer_len;
339 0 0 if (needlelen > haystacklen || !haystacklen || !needlelen)
0 0 if (needlelen > haystacklen || !haystacklen || !needlelen)
0 0 if (needlelen > haystacklen || !haystacklen || !needlelen)
345 0 0 if (needlelen == 1)
348 0 0 if (n[0] == n[1]) {
357 0 0 while (j <= haystacklen - needlelen) {
358 0 0 if (n[1] != h[j + 1]) {
361 0 0 if (memcmp(n + 2, h + j + 2, needlelen - 2) == 0 &&
0 0 if (memcmp(n + 2, h + j + 2, needlelen - 2) == 0 &&
381 0 0 for (i = 0; i < line_count; ++i) {
385 0 0 for (j = 0; j < LINE_WIDTH; ++j, ++line) {
388 0 0 if (j == (LINE_WIDTH / 2))
395 0 0 for (j = 0; j < LINE_WIDTH; ++j, ++line)
396 0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
401 0 0 if (last_line > 0) {
405 0 0 for (j = 0; j < last_line; ++j, ++line) {
408 0 0 if (j == (LINE_WIDTH / 2))
412 0 0 if (j < (LINE_WIDTH / 2))
414 0 0 for (j = 0; j < (LINE_WIDTH - last_line); ++j)
420 0 0 for (j = 0; j < last_line; ++j, ++line)
421 0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
0 0 printf("%c", (*line >= 32 && *line <= 126) ? *line : '.');
500 0 0 for (i = -nblocks; i; i++) {
568 4406 3306 for (lim = array_len; lim != 0; lim >>= 1) {
571 201 4205 if (cmp == 0) {
575 1176 3029 if (cmp > 0) { /* key > p; take right partition */
581 3504 3 if (position)
584 201 3306 return (cmp == 0) ? 0 : GIT_ENOTFOUND;
599 0 0 for (lim = array_len; lim != 0; lim >>= 1) {
602 0 0 if (cmp == 0) {
606 0 0 if (cmp > 0) { /* key > p; take right partition */
612 0 0 if (position)
615 0 0 return (cmp == 0) ? 0 : GIT_ENOTFOUND;
637 649 0 if (value == NULL ||
290 359 if (value == NULL ||
638 290 0 !strcasecmp(value, "true") ||
639 0 290 !strcasecmp(value, "yes") ||
644 14 276 if (!strcasecmp(value, "false") ||
14 0 if (!strcasecmp(value, "false") ||
645 14 0 !strcasecmp(value, "no") ||
646 0 14 !strcasecmp(value, "off") ||
659 0 32 if (!str)
662 141 32 for (scan = str; *scan; pos++, scan++) {
663 0 141 if (*scan == '\\' && *(scan + 1) != '\0')
0 0 if (*scan == '\\' && *(scan + 1) != '\0')
665 0 141 if (pos != scan)
669 0 32 if (pos != scan) {
698 4 4 while (elsize) {
715 50 22 for (i = base + elsize; i < end; i += elsize)
716 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)
774 87 174 if (!val)
814 3 0 if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)