summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-03-14 14:27:23 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-03-14 14:27:23 -0700
commit27ac2b1f24d034f89e87d79768fe94a4e7559b93 (patch)
treec56d7578b790bde72ed9ea323b639a58a35a5b9f
parentMerge branch 'sr/add--interactive-term-readkey' (diff)
parentcommit.c: use skip_prefix() instead of starts_with() (diff)
downloadtgif-27ac2b1f24d034f89e87d79768fe94a4e7559b93.tar.xz
Merge branch 'ta/parse-commit-with-skip-prefix'
* ta/parse-commit-with-skip-prefix: commit.c: use skip_prefix() instead of starts_with()
-rw-r--r--commit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/commit.c b/commit.c
index 6bf4fe00d4..fa401ae7b0 100644
--- a/commit.c
+++ b/commit.c
@@ -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;
@@ -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;
@@ -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;