Re: [PATCH v3] commit.c: Replace starts_with() with skip_prefix()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 6, 2014, 19:42 UTC
- Message-ID
- <xmqqfvmvxgf5.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1394125521-9341-1-git-send-email-karthik.188@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 18 quoted lines
> @@ -1098,6 +1099,7 @@ int parse_signed_commit(const unsigned char *sha1, > char *buffer = read_sha1_file(sha1, &type, &size); > int in_signature, saw_signature = -1; > char *line, *tail; > + const char *gpg_sig; > > if (!buffer || type != OBJ_COMMIT) > goto cleanup; > @@ -1113,9 +1115,9 @@ int parse_signed_commit(const unsigned char *sha1, > next = next ? next + 1 : tail; > if (in_signature && line[0] == ' ') > sig = line + 1; > - else if (starts_with(line, gpg_sig_header) && > - line[gpg_sig_header_len] == ' ') > - sig = line + gpg_sig_header_len + 1; > + else if ((gpg_sig = skip_prefix(line, gpg_sig_header)) > + && gpg_sig[0] == ' ') > + sig = gpg_sig + 1;
I am not sure if this hunk is a great improvement, as we know the length of what we are skipping in the gpg_sig_header_len constant that is used throughout this file.