Re: [PATCH v2 10/20] ref-cache: introduce a new type, ref_cache

2017-04-15 Thread Michael Haggerty
On 04/07/2017 01:32 PM, Duy Nguyen wrote: > On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty > 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

Re: [PATCH v2 10/20] ref-cache: introduce a new type, ref_cache

2017-04-07 Thread Duy Nguyen
On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty 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().

[PATCH v2 10/20] ref-cache: introduce a new type, ref_cache

2017-03-31 Thread Michael Haggerty
For now, it just wraps a `ref_entry *` that points at the root of the tree. Soon it will hold more information. Add two new functions, `create_ref_cache()` and `free_ref_cache()`. Make `free_ref_entry()` private. Change files-backend to use this type to hold its caches. Signed-off-by: Michael