All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] difftool: add env vars directly in run_file_diff()
Date: Wed, 29 May 2024 09:57:08 +0200	[thread overview]
Message-ID: <Zlbf1IY4jFlUPD7e@tanuki> (raw)
In-Reply-To: <c7c843b9-0ccf-4bcb-a036-d794729a99d6@web.de>

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

On Sun, May 26, 2024 at 10:16:50PM +0200, René Scharfe wrote:
> Add the environment variables of the child process directly using
> strvec_push() instead of building an array out of them and then adding
> that using strvec_pushv().  The new code is shorter and avoids magic
> array index values and fragile array padding.
> 
> Signed-off-by: René Scharfe <l.s.r@web.de>

I don't know whether this may cause more allocations. But even if it
did, it would very much feel like a micro-optimization that is not worth
it in the end given that we're about to spawn a new process anyway,
which is way more expensive.

So favoring readability/maintainability very much feels like the right
thing to do here, and the result looks good to me. Thanks!

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-05-29  7:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-26 20:16 [PATCH] difftool: add env vars directly in run_file_diff() René Scharfe
2024-05-29  7:57 ` Patrick Steinhardt [this message]
2024-06-01 20:23   ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zlbf1IY4jFlUPD7e@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.