Re: [PATCH] [PATCH] commit.c: Replace starts_with() with skip_prefix()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 4, 2014 at 12:58 PM, karthik nayak <karthik.188@xxxxxxxxx> wrote:
> Hey Tanay,
>
> 1. Yes just getting used to git send-email now, should follow that from now
> 2. I thought it shouldn't be a part of the commit, so i put it after
> the last ---
> 3. I did have a thought on your lines also , but concluded to it being
> more advantageous, you might be right though

Minor etiquette note: On this list, respond inline rather than top-posting.

To understand why, look at how much scrolling up and down a person has
to do to relate your points 1, 2, and 3 to review statements made by
Tanay at the very bottom of the email.

> Nice to hear from you.
> Thanks
> -Karthik Nayak
>
> On Tue, Mar 4, 2014 at 11:01 PM, Tanay Abhra <tanayabh@xxxxxxxxx> wrote:
>>
>> Karthik Nayak <karthik.188 <at> gmail.com> writes:
>>
>>>
>>> In record_author_date() :
>>> Replace "buf + strlen(author )" by skip_prefix(), which is
>>> saved in a new "const char" variable "indent_line".
>>>
>>> In parse_signed_commit() :
>>> Replace "line + gpg_sig_header_len" by skip_prefix(), which
>>> is saved in a new "const char" variable "indent_line".
>>>
>>> In parse_gpg_output() :
>>> Replace "buf + strlen(sigcheck_gpg_status[i].check + 1)" by
>>> skip_prefix(), which is saved in already available
>>> variable "found".
>>>
>>> Signed-off-by: Karthik Nayak <karthik.188 <at> gmail.com>
>>> ---
>>>  commit.c | 23 ++++++++++++-----------
>>>  1 file changed, 12 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/commit.c b/commit.c
>>> index 6bf4fe0..71a03e3 100644
>>> --- a/commit.c
>>> +++ b/commit.c
>>
>>>  <at>  <at>  -1098,6 +1100,7  <at>  <at>  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 *indent_line;
>>>
>>>       if (!buffer || type != OBJ_COMMIT)
>>>               goto cleanup;
>>>  <at>  <at>  -1111,11 +1114,11  <at>  <at>  int parse_signed_commit(const
>> unsigned char *sha1,
>>>               char *next = memchr(line, '\n', tail - line);
>>>
>>>               next = next ? next + 1 : tail;
>>> +             indent_line = skip_prefix(line, gpg_sig_header);
>>>               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 (indent_line && indent_line[1] == ' ')
>>> +                     sig = indent_line + 2;
>>>               if (sig) {
>>>                       strbuf_add(signature, sig, next - sig);
>>>                       saw_signature = 1;
>>
>>
>> Hi,
>>
>> I was attempting the same microproject so I thought I would share some
>> points that were told to me earlier .The mail subject should have a
>> increasing order of submission numbers for each revision(for example here it
>> should be [PATCH v2]).
>>
>> Also write the superfluous stuff which you have written in the bottom
>> after ---(the three dashes after the signed off statement) .
>>
>> In the parse_signed_commit() function, gpg_sig_header_len and gpg_sig_header
>> variables are precomputed outside of the function, and also Junio said to
>> prefer starts_with(), whenever skip_prefix() advantages are not so important
>> in the context.So the replace may not be so advantageous ,I may be wrong in
>> this case.
>>
>>
>>
>> Cheers,
>> Tanay Abhra.
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]