MCPcopy Index your code
hub / github.com/git/git / get_extended_base_var

Function get_extended_base_var

config.c:945–981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

943}
944
945static int get_extended_base_var(struct config_source *cs, struct strbuf *name,
946 int c)
947{
948 cs->subsection_case_sensitive = 0;
949 do {
950 if (c == '\n')
951 goto error_incomplete_line;
952 c = get_next_char(cs);
953 } while (isspace(c));
954
955 /* We require the format to be '[base "extension"]' */
956 if (c != '"')
957 return -1;
958 strbuf_addch(name, '.');
959
960 for (;;) {
961 int c = get_next_char(cs);
962 if (c == '\n')
963 goto error_incomplete_line;
964 if (c == '"')
965 break;
966 if (c == '\\') {
967 c = get_next_char(cs);
968 if (c == '\n')
969 goto error_incomplete_line;
970 }
971 strbuf_addch(name, c);
972 }
973
974 /* Final ']' */
975 if (get_next_char(cs) != ']')
976 return -1;
977 return 0;
978error_incomplete_line:
979 cs->linenr--;
980 return -1;
981}
982
983static int get_base_var(struct config_source *cs, struct strbuf *name)
984{

Callers 1

get_base_varFunction · 0.85

Calls 2

get_next_charFunction · 0.85
strbuf_addchFunction · 0.85

Tested by

no test coverage detected