git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.

Previous: Eric SunshineNext: Jeff King
Message 3 of 8 in “prefix_path(): Unconditionally free result of prefix_path”
  1. prefix_path(): Unconditionally free result of prefix_pathStefan Beller, May 4, 2015
  2. Eric SunshineMay 4, 2015
  3. Junio C HamanoMay 4, 2015
  4. Jeff KingMay 5, 2015
  5. Stefan BellerMay 5, 2015
  6. Junio C HamanoMay 5, 2015
  7. Jeff KingMay 5, 2015
  8. Junio C HamanoMay 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.