MCPcopy Create free account
hub / github.com/git/git / find_separator

Function find_separator

trailer.c:633–649  ·  view source on GitHub ↗

* If the given line is of the form * " ..." or " ...", return the * location of the separator. Otherwise, return -1. The optional whitespace * is allowed there primarily to allow things like "Bug #43" where is * "Bug" and is "#". * * The separator-starts-line case (in which this function returns 0) is * distinguished from

Source from the content-addressed store, hash-verified

631 * returns -1) because some callers of this function need such a distinction.
632 */
633static ssize_t find_separator(const char *line, const char *separators)
634{
635 int whitespace_found = 0;
636 const char *c;
637 for (c = line; *c; c++) {
638 if (strchr(separators, *c))
639 return c - line;
640 if (!whitespace_found && (isalnum(*c) || *c == '-'))
641 continue;
642 if (c != line && (*c == ' ' || *c == '\t')) {
643 whitespace_found = 1;
644 continue;
645 }
646 break;
647 }
648 return -1;
649}
650
651/*
652 * Obtain the token, value, and conf from the given trailer.

Callers 6

validate_trailer_argsFunction · 0.85
find_trailer_block_startFunction · 0.85
trailer_block_getFunction · 0.85
parse_trailersFunction · 0.85
trailer_iterator_advanceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected