Re: [PATCH v2 1/1] zlib.c: use size_t for size
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Oct 15, 2018, 00:41 UTC
- Message-ID
- <d3d291ea-00d2-f0dd-5a43-cbea5476d64d@ramsayjones.plus.com>
- In-Reply-To
- <20181015000147.GB13510@sigill.intra.peff.net>
On 15/10/18 01:01, Jeff King wrote:
Show 21 quoted lines
> On Sun, Oct 14, 2018 at 04:03:48PM +0100, Ramsay Jones wrote:
>
>>> So I kind of wonder if a comment would be better than xsize_t here.
>>> Something like:
>>>
>>> if (avail > len) {
>>> /*
>>> * This can never truncate because we know that len is smaller
>>> * than avail, which is already a size_t.
>>> */
>>> avail = (size_t)len;
>>> }
>>
>> Heh, you are, of course, correct! (that will learn me[1]). :-D
>>
>> Hmm, let's see if I can muster the enthusiasm to do all that
>> testing again!
>
> For the record, I am not opposed to including the comment _and_ using
> xsize_t() to do the cast, giving us an assertion that the comment is
> correct.Heh, I haven't found any enthusiasm tonight. Let's see if there are any more comments/opinions.
Thanks.
ATB, Ramsay Jones