From: Michael Haggerty Date: Sun, 19 Mar 2017 20:38:19 GMT Subject: Re: [PATCH v6 11/27] refs.c: introduce get_main_ref_store() Message-ID: <511a2789-0f4e-2e65-94a9-eaaff858aa76@alum.mit.edu> In-Reply-To: <20170318020337.22767-12-pclouds@gmail.com> On 03/18/2017 03:03 AM, Nguyễn Thái Ngọc Duy wrote: > Signed-off-by: Nguyễn Thái Ngọc Duy > --- > refs.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/refs.c b/refs.c > index e7606716dd..2637353b72 100644 > --- a/refs.c > +++ b/refs.c > @@ -1456,15 +1456,23 @@ static struct ref_store *ref_store_init(const char *submodule) > return refs; > } > > +static struct ref_store *get_main_ref_store(void) > +{ > + struct ref_store *refs; > + > + if (main_ref_store) > + return main_ref_store; > + > + refs = ref_store_init(NULL); > + return refs; > +} > + I still [1] think that `refs` here is an unnecessary temporary variable. And even after your "kill register_ref_store" patch I think it is superfluous and the function could look like static struct ref_store *get_main_ref_store(void) { if (!main_ref_store) main_ref_store = ref_store_init(NULL); return main_ref_store; } > [...] Michael [1] http://public-inbox.org/git/0bef1e49-e96b-1666-9b88-f4262c2aeeba@alum.mit.edu/