Re: [PATCHv3 2/6] alloc: make allocate_alloc_state and clear_alloc_state more consistent
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 15, 2018, 05:18 UTC
- Message-ID
- <20180815051808.GD32543@aiede.svl.corp.google.com>
- In-Reply-To
- <20180813171749.10481-3-newren@gmail.com>
Elijah Newren wrote:
Show 9 quoted lines
> Since both functions are using the same data type, they should either both > refer to it as void *, or both use the real type (struct alloc_state *). > Opt for the latter. > > Signed-off-by: Elijah Newren <newren@gmail.com> > --- > alloc.c | 2 +- > alloc.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-)
This API comes from 14ba97f8 (alloc: allow arbitrary repositories for alloc functions, 2018-05-15). The pointer returned by allocate_alloc_state points to an initialized, usable object so returning a struct instead of a void pointer is the right thing to do. Thanks for noticing and fixing it.
That commit in turn was probably inspired by v1.5.2-rc0~16^2 (Clean up object creation to use more common code, 2007-04-16), which was following the same convention (void * for raw memory, struct blob * for initialized object).
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>