Branch Coverage

deps/libgit2/src/xdiff/xutils.c
Criterion Covered Total %
branch 61 204 29.9


line true false branch
34 202 219 for (i = 1; n > 0; n >>= 2)
50 57 0 if (size > 0 && rec[size - 1] != '\n') {
24 33 if (size > 0 && rec[size - 1] != '\n') {
55 0 57 if (ecb->outf(ecb->priv, mb, i) < 0) {
91 215 219 for (cur = cha->head; (tmp = cur) != NULL;) {
102 110 190 if (!(ancur = cha->ancur) || ancur->icurr == cha->nsize) {
25 85 if (!(ancur = cha->ancur) || ancur->icurr == cha->nsize) {
103 0 215 if (!(ancur = (chanode_t *) xdl_malloc(sizeof(chanode_t) + cha->nsize))) {
109 25 190 if (cha->tail)
111 190 25 if (!cha->head)
127 146 0 if ((cur = data = xdl_mmfile_first(mf, &size)) != NULL) {
128 309 0 for (top = data + size; nl < sample && cur < top; ) {
163 146 for (top = data + size; nl < sample && cur < top; ) {
130 96 67 if (!(cur = memchr(cur, '\n', top - cur)))
138 117 29 if (nl && tsize)
117 0 if (nl && tsize)
148 0 0 if (!(flags & XDF_WHITESPACE_FLAGS))
151 0 0 for (i = 0; i < size && XDL_ISSPACE(line[i]); i++)
0 0 for (i = 0; i < size && XDL_ISSPACE(line[i]); i++)
163 0 0 int complete = s && l[s-1] == '\n';
0 0 int complete = s && l[s-1] == '\n';
165 0 0 if (complete)
167 0 0 if (s == i)
170 0 0 if (complete && s == i + 1 && l[i] == '\r')
0 0 if (complete && s == i + 1 && l[i] == '\r')
0 0 if (complete && s == i + 1 && l[i] == '\r')
179 44 7 if (s1 == s2 && !memcmp(l1, l2, s1))
38 6 if (s1 == s2 && !memcmp(l1, l2, s1))
181 13 0 if (!(flags & XDF_WHITESPACE_FLAGS))
195 0 0 if (flags & XDF_IGNORE_WHITESPACE) {
197 0 0 while (i1 < s1 && i2 < s2) {
0 0 while (i1 < s1 && i2 < s2) {
198 0 0 if (l1[i1++] != l2[i2++])
201 0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
203 0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
206 0 0 } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
207 0 0 while (i1 < s1 && i2 < s2) {
0 0 while (i1 < s1 && i2 < s2) {
208 0 0 if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
0 0 if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
210 0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
212 0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
216 0 0 if (l1[i1++] != l2[i2++])
219 0 0 } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
220 0 0 while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
0 0 while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
0 0 while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
224 0 0 } else if (flags & XDF_IGNORE_CR_AT_EOL) {
226 0 0 while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
0 0 while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
0 0 while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
240 0 0 if (i1 < s1) {
241 0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
243 0 0 if (s1 != i1)
246 0 0 if (i2 < s2) {
247 0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
260 0 0 for (; ptr < top && *ptr != '\n'; ptr++) {
0 0 for (; ptr < top && *ptr != '\n'; ptr++) {
261 0 0 if (cr_at_eol_only) {
263 0 0 if (*ptr == '\r' &&
0 0 if (*ptr == '\r' &&
264 0 0 (ptr + 1 < top && ptr[1] == '\n'))
267 0 0 else if (XDL_ISSPACE(*ptr)) {
270 0 0 while (ptr + 1 < top && XDL_ISSPACE(ptr[1])
0 0 while (ptr + 1 < top && XDL_ISSPACE(ptr[1])
271 0 0 && ptr[1] != '\n')
273 0 0 at_eol = (top <= ptr + 1 || ptr[1] == '\n');
0 0 at_eol = (top <= ptr + 1 || ptr[1] == '\n');
274 0 0 if (flags & XDF_IGNORE_WHITESPACE)
276 0 0 else if (flags & XDF_IGNORE_WHITESPACE_CHANGE
277 0 0 && !at_eol) {
281 0 0 else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
282 0 0 && !at_eol) {
283 0 0 while (ptr2 != ptr + 1) {
294 0 0 *data = ptr < top ? ptr + 1: ptr;
303 0 163 if (flags & XDF_WHITESPACE_FLAGS)
306 2895 96 for (; ptr < top && *ptr != '\n'; ptr++) {
2828 67 for (; ptr < top && *ptr != '\n'; ptr++) {
310 67 96 *data = ptr < top ? ptr + 1: ptr;
318 505 219 for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++);
505 0 for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++);
319 219 0 return bits ? bits: 1;
329 0 109 if (val < 0) {
333 51 109 for (; val && ptr > buf; val /= 10)
51 0 for (; val && ptr > buf; val /= 10)
335 51 58 if (*ptr)
336 51 51 for (; *ptr; ptr++, str++)
354 26 12 nb += xdl_num_out(buf + nb, c1 ? s1: s1 - 1);
356 28 10 if (c1 != 1) {
366 3 35 nb += xdl_num_out(buf + nb, c2 ? s2: s2 - 1);
368 5 33 if (c2 != 1) {
377 38 0 if (func && funclen) {
0 38 if (func && funclen) {
379 0 0 if (funclen > (long)(sizeof(buf) - nb - 1))
388 0 38 if (ecb->outf(ecb->priv, &mb, 1) < 0)
414 0 0 if (xdl_do_diff(&subfile1, &subfile2, xpp, &env) < 0)