Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-18 Thread Junio C Hamano
Jeff King writes: > I'm a little worried, though, that use sites without initializers would > be left behind. For example, git_proxy_connect uses xcalloc to allocate > the child_process, which results in all-bits-zero. If we want to start > caring about the initialization, we probably need to pro

Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-17 Thread Jeff King
On Sun, Aug 17, 2014 at 09:46:42AM +0200, Johannes Sixt wrote: > This is a step in the right direction, IMO. This way to initialize the > struct feels mucth better because it does not depend on that the bit > pattern of the NULL pointer is all zeros. I think platforms with NULL as something besid

Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-17 Thread Johannes Sixt
Am 17.08.2014 00:55, schrieb René Scharfe: > Most struct child_process variables are cleared using memset right after > declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to > initialize them statically instead. That's shorter, doesn't require a > function call and is slightly mor

Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-17 Thread Jeff King
On Sun, Aug 17, 2014 at 09:25:58AM +0200, René Scharfe wrote: > >I think one reason we never had an INIT macro here is that you cannot > >simply use the struct after zero-ing it anyway. That's just the first > >step, and then you have to tweak a bunch of fields to get what you want. > >So the mems

Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-17 Thread René Scharfe
Am 17.08.2014 um 09:12 schrieb Jeff King: On Sun, Aug 17, 2014 at 12:55:23AM +0200, René Scharfe wrote: Most struct child_process variables are cleared using memset right after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's sho

Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-17 Thread Jeff King
On Sun, Aug 17, 2014 at 12:55:23AM +0200, René Scharfe wrote: > Most struct child_process variables are cleared using memset right after > declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to > initialize them statically instead. That's shorter, doesn't require a > function call

[PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-16 Thread René Scharfe
Most struct child_process variables are cleared using memset right after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's shorter, doesn't require a function call and is slightly more readable (especially given that we already have s