qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
realloc Functions
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The realloc family of functions changes the size of a previously
     allocated memory block. The <memblock> argument points to the
     beginning of the memory block. If <memblock> is NULL, realloc
     functions in the same way as malloc and allocates a new block of
     <size> bytes. If <memblock> is not NULL, it should be a pointer
     returned by calloc, malloc, or a prior call to realloc.
 
     The <size> argument gives the new size of the block, in bytes. The
     contents of the block are unchanged up to the shorter of the new
     and old sizes, although the new block may be in a different
     location.
 
     The <memblock> argument can also point to a block that has been
     freed, as long as there has been no intervening call to the
     corresponding calloc, _expand, malloc, or realloc function. If
     successful, the reallocated block is marked in use.
 
     In large data models (that is, compact-, large-, and huge-model
     programs), realloc maps to _frealloc. In small data models (tiny-,
     small-, and medium-model programs), realloc maps to _nrealloc.
 
     The various realloc functions reallocate memory in the heaps
     specified below:
 
     Function      Heap
 
     realloc       Depends on data model of the program
     _brealloc     Based heap specified by <seg> value
     _frealloc     Far heap (outside default data segment)
     _nrealloc     Near heap (inside default data segment)
 
     Return Value
 
     The realloc function returns a void pointer to the reallocated
     (and possibly moved) memory block.
 
     The return value is NULL if the size is zero and the buffer
     argument is non-NULL, or if there is not enough available memory
     to expand the block to the given size. In the first case, the
     original block is freed. In the second, the original block is
     unchanged.
 
     The storage space pointed to by the return value is guaranteed to
     be suitably aligned for storage of any type object. To get a
     pointer to a type other than void, use a type cast on the return
     value.
                                    -♦-