Re: [PATCH 0/6] getenv() timing fixes
- From
Jeff King <peff@peff.net>
- Date
- Jan 15, 2019, 19:13 UTC
- Message-ID
- <20190115191359.GC4886@sigill.intra.peff.net>
- In-Reply-To
- <CAGZ79kZrcC=SBrBR_4JDWu4Odgz-Uf7LrusiKNe6tgs02JeAMA@mail.gmail.com>
On Sat, Jan 12, 2019 at 10:51:42AM -0800, Stefan Beller wrote:
> > I wonder, and not as "you should do this" feedback on this series, just > > There is a getenv_safe() in environment.c, but I guess a xgetenv() that > takes the same parameters as getenv() is better for ease of use.
Yes, but it punts on the memory ownership by stuffing everything into an argv_array. That saves a few lines if you're going to ask for five variables, but for a single variable it's no better than:
char *foo = getenv_safe("FOO");...use foo...
free(foo);
-Peff