Branch Coverage

deps/libgit2/src/libgit2/config_parse.c
Criterion Covered Total %
branch 72 160 45.0


line true false branch
17 0 0 if (col)
30 0 4427 return isalnum(c) || c == '-';
0 0 return isalnum(c) || c == '-';
38 48215 1962 for (ptr = line; *ptr; ++ptr) {
39 0 48215 if (ptr[0] == '"' && ((ptr > line && ptr[-1] != '\\') || ptr == line))
0 0 if (ptr[0] == '"' && ((ptr > line && ptr[-1] != '\\') || ptr == line))
0 0 if (ptr[0] == '"' && ((ptr > line && ptr[-1] != '\\') || ptr == line))
0 0 if (ptr[0] == '"' && ((ptr > line && ptr[-1] != '\\') || ptr == line))
42 48215 0 if ((ptr[0] == ';' || ptr[0] == '#') &&
0 48215 if ((ptr[0] == ';' || ptr[0] == '#') &&
0 0 if ((ptr[0] == ';' || ptr[0] == '#') &&
43 0 0 (quote_count % 2) == 0 &&
49 0 48215 if (ptr[0] == '\\')
56 3924 0 while (ptr > line && git__isspace(ptr[-1])) {
1962 1962 while (ptr > line && git__isspace(ptr[-1])) {
74 0 273 while (git__isspace(line[pos]))
78 0 273 if (line[pos] != '"') {
87 0 273 if ((last_quote - line) > INT_MAX) {
92 0 273 if (quoted_len == 0) {
97 0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
98 0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
126 0 0 if (c == 0) {
137 2098 273 } while (line + rpos < last_quote);
140 0 273 if (git_str_oom(&buf))
143 273 0 if (line[rpos] != '"' || line[rpos + 1] != ']') {
0 273 if (line[rpos] != '"' || line[rpos + 1] != ']') {
168 0 942 if (line == NULL)
173 0 942 if (name_end == NULL) {
179 0 942 GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
0 942 GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
181 0 942 GIT_ERROR_CHECK_ALLOC(name);
188 0 942 GIT_ASSERT(c == '[');
193 273 4427 if (git__isspace(c)){
201 0 4427 if (!config_keychar(c) && c != '.') {
0 0 if (!config_keychar(c) && c != '.') {
208 3758 669 } while ((c = line[pos++]) != ']');
210 0 669 if (line[pos - 1] != ']') {
234 0 251 if (bom == GIT_STR_BOM_UTF8)
290 0 1962 if (GIT_ADD_SIZET_OVERFLOW(&alloc_len, ptr_len, 1) ||
0 1962 if (GIT_ADD_SIZET_OVERFLOW(&alloc_len, ptr_len, 1) ||
297 25629 1962 while (*ptr != '\0') {
298 0 25629 if (*ptr == '"') {
300 25629 0 } else if (*ptr != '\\') {
306 0 0 if (*ptr == '\0') {
310 0 0 if ((esc = strchr(git_config_escapes, *ptr)) != NULL) {
333 0 0 while (multiline) {
340 0 0 GIT_ERROR_CHECK_ALLOC(line);
341 0 0 if (GIT_ADD_SIZET_OVERFLOW(line_len, *line_len, reader->ctx.line_len)) {
0 0 if (GIT_ADD_SIZET_OVERFLOW(line_len, *line_len, reader->ctx.line_len)) {
350 0 0 if (line[0] == '\0') {
357 0 0 if (line[0] == '\0')
360 0 0 if ((error = unescape_line(&proc_line, &multiline,
365 0 0 if ((error = git_str_puts(value, proc_line)) < 0)
385 1962 14738 return isalnum(c) || c == '-';
0 1962 return isalnum(c) || c == '-';
396 16700 0 while (*name_end && is_namechar(*name_end))
14738 1962 while (*name_end && is_namechar(*name_end))
399 0 1962 if (line == name_end) {
406 3924 0 while (*value_start && git__isspace(*value_start))
1962 1962 while (*value_start && git__isspace(*value_start))
409 1962 0 if (*value_start == '=') {
411 0 0 } else if (*value_start) {
416 0 1962 if ((*name = git__strndup(line, name_end - line)) == NULL)
434 0 1962 GIT_ERROR_CHECK_ALLOC(line);
438 0 1962 if ((error = parse_name(&name, &value_start, reader, line)) < 0)
444 1962 0 if (value_start != NULL) {
445 1962 1962 while (git__isspace(value_start[0]))
448 0 1962 if ((error = unescape_line(&value, &multiline, value_start, 0)) < 0)
451 0 1962 if (multiline) {
506 2904 251 for (; ctx->remain_len > 0; git_parse_advance_line(ctx)) {
530 0 942 if (result < 0)
535 178 764 if (on_section)
544 0 942 if (!git_parse_peek(&c, ctx, GIT_PARSE_PEEK_SKIP_WHITESPACE))
555 0 0 if (on_comment) {
561 1962 0 if ((result = parse_variable(parser, &var_name, &var_value, &line_len)) == 0 && on_variable) {
1962 0 if ((result = parse_variable(parser, &var_name, &var_value, &line_len)) == 0 && on_variable) {
570 0 2904 if (result < 0)
574 50 201 if (on_eof)