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 5:27 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Tue, Mar 4, 2014 at 10:54 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote:
>> diff --git a/commit.c b/commit.c
>> index 6bf4fe0..71a03e3 100644
>> --- a/commit.c
>> +++ b/commit.c
>> @@ -1193,10 +1196,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);
>
> Add a space after the plus sign.
>
>> +               if(!found) {
>>                         found = strstr(buf, sigcheck_gpg_status[i].check);
>
> 'found' is being computed again here, even though you already computed
> it just above via skip_prefix(). This seems pretty wasteful.

Ignore this objection. I must have misread the code as I was composing
the email.
--
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]