From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, sunshine@sunshineco.com
Subject: Re: [PATCH v3] commit.c: Replace starts_with() with skip_prefix()
Date: Thu, 06 Mar 2014 11:42:22 -0800 [thread overview]
Message-ID: <xmqqfvmvxgf5.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1394125521-9341-1-git-send-email-karthik.188@gmail.com> (Karthik Nayak's message of "Thu, 6 Mar 2014 22:35:21 +0530")
Karthik Nayak <karthik.188@gmail.com> writes:
> @@ -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.
next prev parent reply other threads:[~2014-03-06 19:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 17:05 [PATCH v3] commit.c: Replace starts_with() with skip_prefix() Karthik Nayak
2014-03-06 19:36 ` Junio C Hamano
2014-03-06 19:42 ` Junio C Hamano [this message]
2014-03-07 9:34 ` Eric Sunshine
2014-03-07 12:39 ` karthik nayak
[not found] ` <CAOLa=ZSjEv+p17--8UPN7=p+DfLWyEftjAXZDnxuaDKo96Lj7w@mail.gmail.com>
2014-03-09 7:49 ` Eric Sunshine
2014-03-09 11:10 ` karthik nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfvmvxgf5.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.