Re: [PATCH 53/83] builtin/apply: make find_header() return -1 instead of die()ing

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

 



On Wed, Apr 27, 2016 at 8:10 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Mon, Apr 25, 2016 at 9:18 AM, Duy Nguyen <pclouds@xxxxxxxxx> wrote:
>> On Sun, Apr 24, 2016 at 8:33 PM, Christian Couder
>> <christian.couder@xxxxxxxxx> wrote:
>>> To be compatible with the rest of the error handling in builtin/apply.c,
>>> find_header() should return -1 instead of calling die().
>>>
>>> Unfortunately find_header() already returns -1 when no header is found,
>>> so let's make it return -2 instead in this case.
>>
>> I don't think this is a good way to go. Too many magic numbers. I
>> don't have a better option though. Maybe returning names instead of
>> numbers would help a bit.
>
> I suppose 'hdrsize' could signal this extra condition. For instance,
> always return -1 on error, and set hdrsize to 0 for header not found
> (unless 0 is a valid size?), and -1 for any other error.
>
> But perhaps that's getting too clever...

Yeah, I don't think it would make reading the patch simpler.
--
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]