[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19
From: |
Jim Meyering |
Subject: |
Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19 |
Date: |
Thu, 16 Oct 2003 15:52:32 +0200 |
Bruno Haible <address@hidden> wrote:
> Jim Meyering wrote:
>> /* Caution: N_ALLOC and V must be L-values. */
>> #define XNREALLOC (N_ALLOC, V, MULTIPLIER) \
>> do \
>> { \
>> V = xnrealloc (V, N_ALLOC, (MULTIPLIER) * sizeof *(V)); \
>> N_ALLOC *= MULTIPLIER; \
>
> Usually I use
> N_ALLOC = 2 * N_ALLOC + 1;
> or
> N_ALLOC = 2 * N_ALLOC + 10;
>
> because this allows me to initialize the array with NULL and its size with 0,
> to optimize for the (not so unfrequent) case that the array will not be used
> at all.
Good point.
So use something like this:
N_ALLOC = N_ALLOC * MULTIPLIER + 10;
or maybe add another parameter, INCREMENT?
But that might be too easily confused with `MULTIPLIER'.
Obviously it's better to avoid duplication, but not to
the point of obfuscation.
- [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19, Jim Meyering, 2003/10/16
- Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19, Bruno Haible, 2003/10/16
- Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19,
Jim Meyering <=
- Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19, Paul Eggert, 2003/10/16