Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src



Module Name:    src
Committed By:   joerg
Date:           Tue Feb 17 20:29:21 UTC 2015

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/include: stdlib.h
        src/lib/libc/include: namespace.h
        src/lib/libc/stdlib: Makefile.inc
Added Files:
        src/lib/libc/stdlib: reallocarr.3 reallocarr.c

Log Message:
Introduce reallocarr(3) for easy (re)allocation of memory with overflow
checks. Compared to OpenBSD's reallocarray, makes it easier to avoid memory
leaks on allocation failures and it doesn't depend on malloc(0) != NULL
for correct error checking. Compared to plain realloc, it also avoids
the problem of intermediate integer overflows. The trade-off is the use
of void * to side step C type system with regard to generic pointer to
pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.1946 -r1.1947 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.113 -r1.114 src/include/stdlib.h
cvs rdiff -u -r1.176 -r1.177 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.88 -r1.89 src/lib/libc/stdlib/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/stdlib/reallocarr.3 \
    src/lib/libc/stdlib/reallocarr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index