Re: [PATCH v2 1/2] Clean stale environment pointer in finish_command()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 12, 2014, 16:17 UTC
- Message-ID
- <CAPc5daXRUFqjrZbTE968uP5tY9hF3EG0pMKwGW+YPRLBo5=ghQ@mail.gmail.com>
- In-Reply-To
- <20141112105911.GA31608@peff.net>
On Wed, Nov 12, 2014 at 2:59 AM, Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
>> >> I do not mind much either way. But I doubt that a single extra struct on >> the stack will break the bank, compared to the fact that we are forking >> and execing a new program. I'd also not be surprised if a smart compiler >> could notice that the variables are used exclusively in non-overlapping >> bits of the code, and just reuse the stack space. > > Actually, I take that back. We are passing a pointer to a struct, rather > than by-value, so the compiler cannot know that the sub-function does > not store that pointer in a static variable, and reference it in the > next call. It must use two variables if it cannot see the definition of > run_command. > > I still think it's pointless optimization to worry about, and you should > write whichever is the most readable and maintainable.
Amen. I do not have strong preference either way as long as the result is readable, correct and maintainlable ;-).