Skip to content

Commit 27ac2b1

Browse files
committed
Merge branch 'ta/parse-commit-with-skip-prefix'
* ta/parse-commit-with-skip-prefix: commit.c: use skip_prefix() instead of starts_with()
2 parents e8cb499 + 147972b commit 27ac2b1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

commit.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ define_commit_slab(author_date_slab, unsigned long);
548548
static void record_author_date(struct author_date_slab *author_date,
549549
struct commit *commit)
550550
{
551-
const char *buf, *line_end;
551+
const char *buf, *line_end, *ident_line;
552552
char *buffer = NULL;
553553
struct ident_split ident;
554554
char *date_end;
@@ -566,14 +566,14 @@ static void record_author_date(struct author_date_slab *author_date,
566566
buf;
567567
buf = line_end + 1) {
568568
line_end = strchrnul(buf, '\n');
569-
if (!starts_with(buf, "author ")) {
569+
ident_line = skip_prefix(buf, "author ");
570+
if (!ident_line) {
570571
if (!line_end[0] || line_end[1] == '\n')
571572
return; /* end of header */
572573
continue;
573574
}
574575
if (split_ident_line(&ident,
575-
buf + strlen("author "),
576-
line_end - (buf + strlen("author "))) ||
576+
ident_line, line_end - ident_line) ||
577577
!ident.date_begin || !ident.date_end)
578578
goto fail_exit; /* malformed "author" line */
579579
break;
@@ -1193,10 +1193,8 @@ static void parse_gpg_output(struct signature_check *sigc)
11931193
for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) {
11941194
const char *found, *next;
11951195

1196-
if (starts_with(buf, sigcheck_gpg_status[i].check + 1)) {
1197-
/* At the very beginning of the buffer */
1198-
found = buf + strlen(sigcheck_gpg_status[i].check + 1);
1199-
} else {
1196+
found = skip_prefix(buf, sigcheck_gpg_status[i].check + 1);
1197+
if (!found) {
12001198
found = strstr(buf, sigcheck_gpg_status[i].check);
12011199
if (!found)
12021200
continue;

0 commit comments

Comments
 (0)