History log of /netbsd-src/lib/libc/stdlib/reallocarr.c (Results 1 – 5 of 5)
Revision Date Author Comments
# 3bff2c86 20-Aug-2015 kamil <kamil@NetBSD.org>

Minor alterations to reallocarr(3)

Add comment about division.
Mark error branches with __predict_false().
Reduce one branch with the OR trick.


# b7742922 20-Aug-2015 joerg <joerg@NetBSD.org>

Fix portability.


# 638c990b 28-Jul-2015 kamil <kamil@NetBSD.org>

Compatibility fixes in reallocarr(3)

Make this work on !NetBSD platforms:
- replace __CTASSERT() with platform agnostic solution SQRT_SIZE_MAX
- include nbtool_config.h for cross builds to get defin

Compatibility fixes in reallocarr(3)

Make this work on !NetBSD platforms:
- replace __CTASSERT() with platform agnostic solution SQRT_SIZE_MAX
- include nbtool_config.h for cross builds to get definition of __RCSID()
- restore errno in the last rare code path for platforms affecting errno(2)
in memcpy(2)

While there: rename parameter name 'num' to 'number' to be in sync with
the calloc(3) parameter naming.

Reported by scole_mail at the current-users ml.

show more ...


# f1354ae7 16-Jul-2015 kamil <kamil@NetBSD.org>

Reorder memcpy(3) and save errno


This change is for safety as memcpy(3) might change it.

Approved by <riastradh>


# c9baa596 17-Feb-2015 joerg <joerg@NetBSD.org>

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

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.

show more ...