]> granicus.if.org Git - flex/commit
Added new function reallocarray.
authorMichael McConville <mmcco@mykolab.com>
Sat, 12 Dec 2015 04:04:36 +0000 (23:04 -0500)
committerWill Estes <westes575@gmail.com>
Sat, 12 Dec 2015 20:25:40 +0000 (15:25 -0500)
commit77e54b25ee67ff066d8619d790b43cb2da227ae6
treedd4f5be2eafbb738d731193c76c94d6509af9c90
parent13b5b214f53d1c3354a7ab910bd160c126df1331
Added new function reallocarray.

This is taken from OpenSSH Portable, which in turn takes it from
OpenBSD.

reallocarray wraps the stdlib's realloc function. It takes two size
arguments and checks for overflow, like calloc, but doesn't zero the
memory. Therefore, it allows us to do overflow-safe array reallocations
and overflow-safe unzeroed array allocations, which the stdlib
allocation functions don't.

We have a bunch of specific array allocation macros, none of
which check for overflow. reallocarray should be able to replace them.
configure.ac
lib/reallocarray.c [new file with mode: 0644]
src/flexdef.h