Re: [PATCH v4 05/16] refs.c: refactor get_submodule_ref_store(), share common free block
- From
Stefan Beller <sbeller@google.com>
- Date
- Aug 23, 2017, 19:34 UTC
- Message-ID
- <CAGZ79kZ2e5+trudmcft39UC_PrROwvrrAE0w_-a_b_3s7ZjFQQ@mail.gmail.com>
- In-Reply-To
- <20170823123704.16518-6-pclouds@gmail.com>
On Wed, Aug 23, 2017 at 5:36 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 13 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> refs.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index dec899a57a..522c4ab74f 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1636,7 +1636,6 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
> {
> struct strbuf submodule_sb = STRBUF_INIT;
> struct ref_store *refs;Do we need to assign NULL here, to cover the early outs?
Show 7 quoted lines
> - int ret;
>
> if (!submodule || !*submodule) {
> /*
> @@ -1648,19 +1647,14 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
>
> refs = lookup_ref_store_map(&submodule_ref_stores, submodule);Answering the question from above, no we do not need to assign NULL as we have an unconditional assignment here and any early outs are after this.
Thanks, Stefan