Re: [PATCH] packfile: use extra variable to clarify code in use_pack()

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

 




On 14/03/2019 00:19, Jeff King wrote:
> On Wed, Mar 13, 2019 at 09:49:58PM +0000, Ramsay Jones wrote:
> 
>> From: Jeff King <peff@xxxxxxxx>
>> [...]
>> Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> 
> Signed-off-by: Jeff King <peff@xxxxxxxx>
> 
> Naturally. :)
> 
>> As promised, I am forwarding a 'saved' patch from Jeff, which was
>> a by-product of a long-ago discussion regarding commit 5efde212fc
>> ("zlib.c: use size_t for size", 2018-10-14).
>>
>> I have tested this patch on 'pu' (@6fd68134c8) and directly on top
>> of commit 5efde212fc. (see branch 'mk/use-size-t-in-zlib').
>>
>> However, whilst I have been waiting for the tests to finish, I have
>> been looking at the code and concluded that this does not _have_ to
>> be applied on top of commit 5efde212fc. (I haven't done it, but just
>> tweak the context line to read 'unsigned long *left)' rather than
>> 'size_t *left)' and this should apply cleanly to 'master'. Also, it
>> would have _exactly_ the same effect as the current code! ;-) ).
> 
> I think it does apply, though the reasoning in the commit message of
> "this is OK because 'left' is large enough" becomes a lot more
> hand-wavy. The patch is not making anything _worse_, certainly, but the
> fact of the matter is that "left" still might not be big enough, if it
> is not a size_t.

Yep, the commit message would have to change (it says 'left' is
a size_t), but I think the patch is _still_ an improvement on
the existing code, even without s/unsigned long *left/size_t *left/.
(ie the code is still 'clarified'). :-D

Anyway, it was just an idle FYI while waiting. ;-)

ATB,
Ramsay Jones



[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]

  Powered by Linux