Re: [PATCH] prefix_path(): Unconditionally free result of prefix_path
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 4, 2015, 22:29 UTC
- Message-ID
- <xmqq8ud4ou2b.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CAPig+cSuCouNCuKa99mct4UMPykuMVy3+7sqB6y+v+UtP2oeTw@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 36 quoted lines
> On Mon, May 4, 2015 at 3:11 PM, Stefan Beller <sbeller@google.com> wrote: >> prefix_path(): Unconditionally free result of prefix_path > > Slightly redundant mention of "prefix_path". Also, prevailing custom > is to drop capitalization. > >> prefix_path() always returns a newly allocated string since >> d089eba (setup: sanitize absolute and funny paths in get_pathspec(), >> 2008-01-28) > > I'd probably turn this sentence fragment into a proper sentence: > > As of d089eba (...), prefix_path() always returns a newly > allocated string, so free its result unconditionally. > >> Additionally the const is dropped from the pointers, so the call to >> free doesn't need a cast. > > Imperative mood: > > Additionally, drop the const from variables to which the > prefix_path() result is assigned so they can be free()'d > without having to cast-away constness. > >> Signed-off-by: Stefan Beller <sbeller@google.com> >> --- >> >> Notes: >> Thanks for all the suggestions! >> They are incorporated into this version of the patch. > > Thanks, this version looks much better. > > FWIW, with or without addressing the very minor nits above: > > Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Thanks, both.
To save a round-trip, I'll munge the log message myself stealing Eric's suggestions.