[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 70x speed-up for seq's common cases
From: |
Jim Meyering |
Subject: |
Re: 70x speed-up for seq's common cases |
Date: |
Fri, 14 Sep 2012 11:13:27 +0200 |
Bernhard Voelker wrote:
> On 09/14/2012 10:40 AM, Jim Meyering wrote:
>> Bernhard Voelker wrote:
>>> Shouldn't we free(buf), too?
>>
>> Thanks.
>> Yes, to placate leak-checking tools, but for the record, any time buf
>> was allocated, we'd exit (successfully) right after return from that
>> function.
>>
>> Hence, I've added the free guarded by IF_LINT:
>>
>> @@ -429,7 +429,7 @@ seq_fast (char const *a, char const *b)
>> if (buf < z)
>> fwrite (buf, z - buf, 1, stdout);
>>
>> + IF_LINT (free (buf));
>> }
>
> The other 2 calls to free() could then also be IF_LINT()ed.
No, because they would have an impact (albeit small)
on the following code when seq_fast returns false.