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

Function parse_key_value_squoted

sequencer.c:919–943  ·  view source on GitHub ↗

* Take a series of KEY='VALUE' lines where VALUE part is * sq-quoted, and append at the end of the string list */

Source from the content-addressed store, hash-verified

917 * sq-quoted, and append <KEY, VALUE> at the end of the string list
918 */
919static int parse_key_value_squoted(char *buf, struct string_list *list)
920{
921 while (*buf) {
922 struct string_list_item *item;
923 char *np;
924 char *cp = strchr(buf, '=');
925 if (!cp) {
926 np = strchrnul(buf, '\n');
927 return error(_("no key present in '%.*s'"),
928 (int) (np - buf), buf);
929 }
930 np = strchrnul(cp, '\n');
931 *cp++ = '\0';
932 item = string_list_append(list, buf);
933
934 buf = np + (*np == '\n');
935 *np = '\0';
936 cp = sq_dequote(cp);
937 if (!cp)
938 return error(_("unable to dequote value of '%s'"),
939 item->string);
940 item->util = xstrdup(cp);
941 }
942 return 0;
943}
944
945/**
946 * Reads and parses the state directory's "author-script" file, and sets name,

Callers 1

read_author_scriptFunction · 0.85

Calls 4

errorFunction · 0.85
sq_dequoteFunction · 0.85
xstrdupFunction · 0.85
string_list_appendFunction · 0.70

Tested by

no test coverage detected