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 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 va

Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-16 Thread Junio C Hamano
René Scharfe writes: > Am 16.09.2014 um 05:04 schrieb Junio C Hamano: >> On Sun, Sep 14, 2014 at 9:55 AM, René Scharfe 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

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 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 '='. Th

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 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 assignment to b

Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-15 Thread Junio C Hamano
René Scharfe 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 specify

[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 re