Thread (4 messages) flat view 4 messages, 3 authors, 2019-01-15

Re: [PATCH 0/6] getenv() timing fixes

From: Junio C Hamano <hidden>
Date: 2019-01-15 19:33:00

Jeff King [off-list ref] writes:
On Sat, Jan 12, 2019 at 10:51:42AM -0800, Stefan Beller wrote:
quoted
quoted
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");
You meant xstrdup_or_null(getenv("FOO")) here?  And did Stefan mean

	#define xgetenv(e) xstrdup_or_null(getenv(e))

?
  ...use foo...

  free(foo);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help