Branch Coverage

deps/libgit2/src/libgit2/xdiff/xutils.c
Criterion Covered Total %
branch 62 212 29.2


line true false branch
32 202 219 for (i = 1; n > 0; n >>= 2)
48 57 0 if (size > 0 && rec[size - 1] != '\n') {
24 33 if (size > 0 && rec[size - 1] != '\n') {
53 0 57 if (ecb->out_line(ecb->priv, mb, i) < 0) {
89 215 219 for (cur = cha->head; (tmp = cur) != NULL;) {
100 110 190 if (!(ancur = cha->ancur) || ancur->icurr == cha->nsize) {
25 85 if (!(ancur = cha->ancur) || ancur->icurr == cha->nsize) {
101 0 215 if (!(ancur = (chanode_t *) xdl_malloc(sizeof(chanode_t) + cha->nsize))) {
107 25 190 if (cha->tail)
109 190 25 if (!cha->head)
125 146 0 if ((cur = data = xdl_mmfile_first(mf, &size)) != NULL) {
126 309 0 for (top = data + size; nl < sample && cur < top; ) {
163 146 for (top = data + size; nl < sample && cur < top; ) {
128 96 67 if (!(cur = memchr(cur, '\n', top - cur)))
136 117 29 if (nl && tsize)
117 0 if (nl && tsize)
146 0 0 if (!(flags & XDF_WHITESPACE_FLAGS))
149 0 0 for (i = 0; i < size && XDL_ISSPACE(line[i]); i++)
0 0 for (i = 0; i < size && XDL_ISSPACE(line[i]); i++)
161 0 0 int complete = s && l[s-1] == '\n';
0 0 int complete = s && l[s-1] == '\n';
163 0 0 if (complete)
165 0 0 if (s == i)
168 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')
177 32 7 if (s1 == s2 && !memcmp(l1, l2, s1))
26 6 if (s1 == s2 && !memcmp(l1, l2, s1))
179 13 0 if (!(flags & XDF_WHITESPACE_FLAGS))
193 0 0 if (flags & XDF_IGNORE_WHITESPACE) {
195 0 0 while (i1 < s1 && i2 < s2) {
0 0 while (i1 < s1 && i2 < s2) {
196 0 0 if (l1[i1++] != l2[i2++])
199 0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
201 0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
204 0 0 } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
205 0 0 while (i1 < s1 && i2 < s2) {
0 0 while (i1 < s1 && i2 < s2) {
206 0 0 if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
0 0 if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
208 0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
210 0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
214 0 0 if (l1[i1++] != l2[i2++])
217 0 0 } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
218 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]) {
222 0 0 } else if (flags & XDF_IGNORE_CR_AT_EOL) {
224 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]) {
238 0 0 if (i1 < s1) {
239 0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
0 0 while (i1 < s1 && XDL_ISSPACE(l1[i1]))
241 0 0 if (s1 != i1)
244 0 0 if (i2 < s2) {
245 0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
0 0 while (i2 < s2 && XDL_ISSPACE(l2[i2]))
258 0 0 for (; ptr < top && *ptr != '\n'; ptr++) {
0 0 for (; ptr < top && *ptr != '\n'; ptr++) {
259 0 0 if (cr_at_eol_only) {
261 0 0 if (*ptr == '\r' &&
0 0 if (*ptr == '\r' &&
262 0 0 (ptr + 1 < top && ptr[1] == '\n'))
265 0 0 else if (XDL_ISSPACE(*ptr)) {
268 0 0 while (ptr + 1 < top && XDL_ISSPACE(ptr[1])
0 0 while (ptr + 1 < top && XDL_ISSPACE(ptr[1])
269 0 0 && ptr[1] != '\n')
271 0 0 at_eol = (top <= ptr + 1 || ptr[1] == '\n');
0 0 at_eol = (top <= ptr + 1 || ptr[1] == '\n');
272 0 0 if (flags & XDF_IGNORE_WHITESPACE)
274 0 0 else if (flags & XDF_IGNORE_WHITESPACE_CHANGE
275 0 0 && !at_eol) {
279 0 0 else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
280 0 0 && !at_eol) {
281 0 0 while (ptr2 != ptr + 1) {
292 0 0 *data = ptr < top ? ptr + 1: ptr;
301 0 163 if (flags & XDF_WHITESPACE_FLAGS)
304 2895 96 for (; ptr < top && *ptr != '\n'; ptr++) {
2828 67 for (; ptr < top && *ptr != '\n'; ptr++) {
308 67 96 *data = ptr < top ? ptr + 1: ptr;
316 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++);
317 219 0 return bits ? bits: 1;
327 0 109 if (val < 0) {
331 51 109 for (; val && ptr > buf; val /= 10)
51 0 for (; val && ptr > buf; val /= 10)
333 51 58 if (*ptr)
334 51 51 for (; *ptr; ptr++, str++)
353 26 12 nb += xdl_num_out(buf + nb, c1 ? s1: s1 - 1);
355 28 10 if (c1 != 1) {
365 3 35 nb += xdl_num_out(buf + nb, c2 ? s2: s2 - 1);
367 5 33 if (c2 != 1) {
376 38 0 if (func && funclen) {
0 38 if (func && funclen) {
378 0 0 if (funclen > sizeof(buf) - nb - 1)
387 0 38 if (ecb->out_line(ecb->priv, &mb, 1) < 0)
395 38 0 if (!ecb->out_hunk)
397 0 0 if (ecb->out_hunk(ecb->priv,
0 0 if (ecb->out_hunk(ecb->priv,
0 0 if (ecb->out_hunk(ecb->priv,
425 0 0 if (xdl_do_diff(&subfile1, &subfile2, xpp, &env) < 0)