Copyright (c) 1980, 1991, 1993
The Regents of the University of California. All rights reserved.
This code is derived from software contributed to Berkeley by
the American National Standards Committee X3, on Information
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
1. Redistributions of source code must retain the above copyright
notice, this list of conditions ...
(The comments found at the beginning of the groff file "man3/reallocf.3bsd".)
- general purpose memory allocation functions
for include usage.)
Ft void *
Fn reallocf void *ptr size_t size
function changes the size of the previously allocated memory referenced by
The contents of the memory are unchanged up to the lesser of the new and
If the new size is larger,
the contents of the newly allocated portion of the memory are undefined.
Upon success, the memory referenced by
is freed and a pointer to the newly allocated memory is returned.
may move the memory allocation, resulting in a different return value than
Fa ptr .
function behaves identically to
for the specified size.
Upon failure, when the requested memory cannot be allocated, the passed pointer
is freed to ease the problems with traditional coding styles for
causing memory leaks in libraries.
function returns a pointer, possibly identical to
Fa ptr ,
to the allocated memory
if successful; otherwise a
pointer is returned, and
is set to
if the error was the result of an allocation failure.
The buffer is deallocated in this case.
function first appeared in
Fx 3.0 .