[PATCH] Dynamic growable arrays for internal use
Paul Eggert
eggert@cs.ucla.edu
Thu Jun 1 18:08:00 GMT 2017
On 06/01/2017 09:13 AM, Carlos O'Donell wrote:
>> http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/xalloc.h
>> http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/xmalloc.c
> Before I look...
>
> What license do these files have?
They're GPLed, with copyright assigned to the FSF. Although we haven't
run into a need for an LGPLed version, that would not be hard to
arrange, so I wouldn't worry about the LGPL-vs-GPL licensing issues.
One other thing: I'm implementing a slightly different version for
Gnulib that uses ptrdiff_t rather than size_t for sizes (and is LGPL
rather than GPL since it will clearly have uses in library situations).
Using ptrdiff_t improves reliability, since one can compile with
-fsanitize=undefined to catch integer overflow with size calculations.
Over the years we have found that using size_t for byte and object
counts leads to problems for which there is no effective automated
checking. This is why I suggest that new memory-allocation APIs use
ptrdiff_t rather than size_t.
More information about the Libc-alpha
mailing list