Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-17 Thread Jeff King
On Mon, Sep 15, 2014 at 11:24:04AM -0700, Junio C Hamano wrote: René Scharfe l@web.de writes: The macro ALLOC_GROW manages several aspects of dynamic memory allocations for arrays: It performs overprovisioning in order to avoid reallocations in future calls, updates the allocation

Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-16 Thread René Scharfe
Am 16.09.2014 um 05:04 schrieb Junio C Hamano: On Sun, Sep 14, 2014 at 9:55 AM, René Scharfe l@web.de wrote: +#define REALLOCARRAY(x, alloc) x = xrealloc((x), (alloc) * sizeof(*(x))) I have been wondering if x could be an expression that has an operator that binds weaker than the

Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-15 Thread Junio C Hamano
René Scharfe l@web.de writes: The macro ALLOC_GROW manages several aspects of dynamic memory allocations for arrays: It performs overprovisioning in order to avoid reallocations in future calls, updates the allocation size variable, multiplies the item size and thus allows users to simply

Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-15 Thread Junio C Hamano
On Sun, Sep 14, 2014 at 9:55 AM, René Scharfe l@web.de wrote: +#define REALLOCARRAY(x, alloc) x = xrealloc((x), (alloc) * sizeof(*(x))) I have been wondering if x could be an expression that has an operator that binds weaker than the assignment '='. That may necessitate the LHS of the

[PATCH 1/2] add macro REALLOCARRAY

2014-09-14 Thread René Scharfe
The macro ALLOC_GROW manages several aspects of dynamic memory allocations for arrays: It performs overprovisioning in order to avoid reallocations in future calls, updates the allocation size variable, multiplies the item size and thus allows users to simply specify the item count, performs the