Re: [PATCH v2 10/20] ref-cache: introduce a new type, ref_cache
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Apr 16, 2017, 04:52 UTC
- Message-ID
- <8208a712-e6ea-a2e6-f206-9796f056f1af@alum.mit.edu>
- In-Reply-To
- <CACsJy8Careik7fCtXo_Luu40G8YPXAgZomFKDkCOuuOfEYm7nA@mail.gmail.com>
On 04/07/2017 01:32 PM, Duy Nguyen wrote:
Show 9 quoted lines
> On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>> +void free_ref_cache(struct ref_cache *cache)
>> +{
>> + free_ref_entry(cache->root);
>> + free(cache);
>> +}
>
> free(NULL) is no-op (and safe). Maybe we should follow the same
> pattern for free_ref_cache(). It's really up to you.If I look at other `free_*()` functions in our codebase, it doesn't seem that many of them handle NULL, and that feature wouldn't help the callers of this function. So I think I'll leave it the way that it is.
Michael