*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: reallocarray | Section: 3 | Source: MINIX | File: reallocarray.3
REALLOCARRAY(3) FreeBSD Library Functions Manual REALLOCARRAY(3) NAME reallocarray - reallocate memory for an array of elements checking for overflow SYNOPSIS #define _OPENBSD_SOURCE #include <stdlib.h> void * reallocarray(void *ptr, size_t nmemb, size_t size); DESCRIPTION The reallocarray() function reallocates the pointer ptr to a size appropriate to handle an allocation of nmemb elements in an array where each of the array elements is size bytes using realloc(3) and making sure that overflow does not happen in the multiplication of "nmemb * size". This function is provided for source compatibility with OpenBSD and its use is discouraged in preference to reallocarr(3). RETURN VALUES The reallocarray() function will return NULL if there was overflow or if realloc(3) failed setting errno to EOVERFLOW or preserving the value from realloc(3). SEE ALSO malloc(3), realloc(3), reallocarr(3) STANDARDS reallocarray() is an OpenBSD extension. HISTORY The reallocarray() function first appeared in OpenBSD 5.6. reallocarray() was redesigned in NetBSD 8 as reallocarr(3). For compatibility reasons it's available since NetBSD 8 in the _OPENBSD_SOURCE namespace. CAVEATS The reallocarray() function was designed to facilitate safe, robust programming and overcome the shortcomings of the malloc(3) and realloc(3) functions by centralizing the overflow check in the multiplication of nmemb and size. There are still portability issues (it does not solve the 0 sized allocation return ambiguity in the C standard: does reallocarray() return NULL or a unique pointer to memory that cannot be accessed? Does a NULL mean that an error occurred, and can someone check errno in that case to find out what happened?). For this reason NetBSD decided to go with an alternative implementation, and created reallocarr(3). FreeBSD 14.1-RELEASE-p8 February 5, 2015 FreeBSD 14.1-RELEASE-p8

Navigation Options