Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-24 Thread Junio C Hamano
Matthieu Moy writes: >> More importantly, when is this function evaluated and returned value >> used to fill commit_editmsg_path[]? > > I may have missed something, but I'd say "never", as the code is not > compilable at least with my gcc: It was a rhetorical

Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-24 Thread Pranit Bauva
Hey Matthieu, On Tue, May 24, 2016 at 1:41 PM, Matthieu Moy wrote: > Junio C Hamano writes: > >> Pranit Bauva writes: >> >>> static const char *use_message_buffer; >>> -static const char commit_editmsg[] =

Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-24 Thread Matthieu Moy
Junio C Hamano writes: > Pranit Bauva writes: > >> static const char *use_message_buffer; >> -static const char commit_editmsg[] = "COMMIT_EDITMSG"; >> +static const char commit_editmsg_path[] = git_path_commit_editmsg(); > > The function defined with

Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-24 Thread Pranit Bauva
Hey Junio On Tue, May 24, 2016 at 11:24 AM, Pranit Bauva wrote: >> And you do not free its return value. > This is one of the thing that bugging me with GIT_PATH_FUNC. Wouldn't > not freeing the memory lead to memory leaks? Slight misunderstanding. I got it now. Thanks!

Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-23 Thread Pranit Bauva
Hey Junio, On Tue, May 24, 2016 at 12:46 AM, Junio C Hamano wrote: > Pranit Bauva writes: > >> This is a follow up commit for f932729c (memoize common git-path >> "constant" files, 10-Aug-2015). >> >> It serves two purposes: >> 1. It reduces the

Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-23 Thread Junio C Hamano
Pranit Bauva writes: > This is a follow up commit for f932729c (memoize common git-path > "constant" files, 10-Aug-2015). > > It serves two purposes: > 1. It reduces the number of calls to git_path() . > > 2. It serves the benefits of using GIT_PATH_FUNC as mentioned

[PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG

2016-05-23 Thread Pranit Bauva
This is a follow up commit for f932729c (memoize common git-path "constant" files, 10-Aug-2015). It serves two purposes: 1. It reduces the number of calls to git_path() . 2. It serves the benefits of using GIT_PATH_FUNC as mentioned in the commit message of f932729c. Mentored-by: Lars