From: Duy Nguyen Date: Wed, 01 Mar 2017 12:06:04 GMT Subject: Re: [PATCH v5 09/24] refs.c: introduce get_main_ref_store() Message-ID: In-Reply-To: <0bef1e49-e96b-1666-9b88-f4262c2aeeba@alum.mit.edu> On Wed, Mar 1, 2017 at 12:51 AM, Michael Haggerty wrote: > On 02/22/2017 03:04 PM, 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 81b64b4ed..dab1a21ac 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; > > Unnecessary temporary variable? That's the price for doing too much mechanical conversion :-P On second read, I think I did that on purpose (or by luck) because the "kill register_ref_store" patch needs this intermediate "refs" so we can save it to main_ref_store. Cleaner future patch for the minor uncleanliness in the current one. -- Duy