Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] prefix_path(): Unconditionally free result of prefix_path

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:04:39

Eric Sunshine [off-list ref] writes:
On Mon, May 4, 2015 at 3:11 PM, Stefan Beller [off-list ref] wrote:
quoted
prefix_path(): Unconditionally free result of prefix_path
Slightly redundant mention of "prefix_path". Also, prevailing custom
is to drop capitalization.
quoted
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.
quoted
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.
quoted
Signed-off-by: Stefan Beller <redacted>
---

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 <redacted>
Thanks, both.

To save a round-trip, I'll munge the log message myself stealing
Eric's suggestions.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help