Re: [PATCH v2 1/2] git-compat-util: add a FREEZ() wrapper around free(ptr); ptr = NULL

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

 



Eric Wong <e@xxxxxxxxx> writes:

> Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
>> Hi,
>> 
>> Ævar Arnfjörð Bjarmason wrote:
>> 
>> > Add a FREEZ() wrapper marco for the common pattern of freeing a
>> > pointer and assigning NULL to it right afterwards.
>> 
>> I'm conflicted.  On one hand it makes code more concise and makes it
>> easier for people to remember to assign NULL after freeing a variable.
>> On the other hand it makes git more of a custom dialect of C, which
>> may make the code harder to read and hack on for new contributors.
>
> I think this problem could be avoided by using a more explicit
> name, perhaps: "free_and_null"
>
> Seeing the initial subject, I thought this series was short for
> "freeze" (like "creat").

Both match my thoughts exactly ;-)

> ...
> I don't see the point of a macro wrapper, forcing the user to
> type out the '&' should drive home the point that the pointer
> gets set to NULL.  I also find capitalization tiring-to-read
> because all characters are the same height.

Sounds sensible.

So make Jonathan's freez_impl a public API and rename it to
free_and_null(), perhaps?



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