Skip to content

Commit

Permalink
Merge branch 'ta/parse-commit-with-skip-prefix'
Browse files Browse the repository at this point in the history
* ta/parse-commit-with-skip-prefix:
  commit.c: use skip_prefix() instead of starts_with()
  • Loading branch information
Junio C Hamano committed Mar 14, 2014
2 parents e8cb499 + 147972b commit 27ac2b1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ define_commit_slab(author_date_slab, unsigned long);
static void record_author_date(struct author_date_slab *author_date,
struct commit *commit)
{
const char *buf, *line_end;
const char *buf, *line_end, *ident_line;
char *buffer = NULL;
struct ident_split ident;
char *date_end;
Expand All @@ -566,14 +566,14 @@ static void record_author_date(struct author_date_slab *author_date,
buf;
buf = line_end + 1) {
line_end = strchrnul(buf, '\n');
if (!starts_with(buf, "author ")) {
ident_line = skip_prefix(buf, "author ");
if (!ident_line) {
if (!line_end[0] || line_end[1] == '\n')
return; /* end of header */
continue;
}
if (split_ident_line(&ident,
buf + strlen("author "),
line_end - (buf + strlen("author "))) ||
ident_line, line_end - ident_line) ||
!ident.date_begin || !ident.date_end)
goto fail_exit; /* malformed "author" line */
break;
Expand Down Expand Up @@ -1193,10 +1193,8 @@ static void parse_gpg_output(struct signature_check *sigc)
for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) {
const char *found, *next;

if (starts_with(buf, sigcheck_gpg_status[i].check + 1)) {
/* At the very beginning of the buffer */
found = buf + strlen(sigcheck_gpg_status[i].check + 1);
} else {
found = skip_prefix(buf, sigcheck_gpg_status[i].check + 1);
if (!found) {
found = strstr(buf, sigcheck_gpg_status[i].check);
if (!found)
continue;
Expand Down

0 comments on commit 27ac2b1

Please sign in to comment.