|
NAMEmandoc_malloc , mandoc_realloc ,
mandoc_reallocarray ,
mandoc_calloc , mandoc_strdup ,
mandoc_strndup ,
mandoc_asprintf —
memory allocation function wrappers used in the mandoc
library
SYNOPSIS#include <sys/types.h>
#include <mandoc_aux.h>
void *
void *
void *
void *
char *
char *
int
DESCRIPTIONThese functions call the libc functions of the same names, passing through their return values when successful. In case of failure, they do not return, but instead call err(3). They can be used both internally by any code in the mandoc libraries and externally by programs using that library, for example mandoc(1), man(1), apropos(1), makewhatis(8), and man.cgi(8).The function The argument size is the size of each
object. The argument nmemb is the new number of
objects in the array. The argument ptr is a pointer to
the existing object or array to be resized; if it is
The functions When the objects and strings are no longer needed, the pointers returned by these functions can be passed to free(3). RETURN VALUESThe functionmandoc_asprintf () always returns the number
of characters written, excluding the final NUL byte. It never returns -1.
The other functions always return a valid pointer; they never
return FILESThese functions are implemented in mandoc_aux.c.SEE ALSOasprintf(3), err(3), malloc(3), strdup(3)STANDARDSThe functionsmalloc (),
realloc (), and calloc () are
required by ANSI X3.159-1989
(“ANSI C89”). The functions
strdup () and strndup () are
required by IEEE Std 1003.1-2008
(“POSIX.1”). The function
asprintf () is a widespread extension that first
appeared in the GNU C library.
The function HISTORYThe functionsmandoc_malloc (),
mandoc_realloc (),
mandoc_calloc (), and
mandoc_strdup () have been available since mandoc
1.9.12, mandoc_strndup () since 1.11.5, and
mandoc_asprintf () and
mandoc_reallocarray () since 1.12.4 and 1.13.0.
AUTHORSKristaps Dzonsons <kristaps@bsd.lv>Ingo Schwarze <schwarze@openbsd.org>
Visit the GSP FreeBSD Man Page Interface. |