"Dima Kov via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Dima Kov <dima.kovol@xxxxxxxxx> > Subject: Re: [PATCH] refactor of git_setup_gettext method We do not write in C++, so "method" -> "function". > Use one "free" call at the end of the function, > instead of being dependent on the execution flow. > > Signed-off-by: Dima Kov <dima.kovol@xxxxxxxxx> > --- I think an early return is more readable, but if this were a new code and used the style used in this patch, it would also have been acceptable. IOW, this is probably a borderline "Meh" change, belonging to "what's already commited is good enough and it is not worth the brain cycles to swap it around" category. > gettext.c | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > > diff --git a/gettext.c b/gettext.c > index af2413b47e85..e75c7bfdb1a8 100644 > --- a/gettext.c > +++ b/gettext.c > @@ -109,17 +109,14 @@ void git_setup_gettext(void) > if (!podir) > podir = p = system_path(GIT_LOCALE_PATH); > > - if (!is_directory(podir)) { > - free(p); > - return; > + if (is_directory(podir)) { > + bindtextdomain("git", podir); > + setlocale(LC_MESSAGES, ""); > + setlocale(LC_TIME, ""); > + init_gettext_charset("git"); > + textdomain("git"); > } > > - bindtextdomain("git", podir); > - setlocale(LC_MESSAGES, ""); > - setlocale(LC_TIME, ""); > - init_gettext_charset("git"); > - textdomain("git"); > - > free(p); > } > > > base-commit: de88ac70f3a801262eb3aa087e5d9a712be0a54a