{The S-lang C Library Reference}: SLrealloc

Next Previous Contents

## 97. SLrealloc

Synopsis

  Resize a dynamic memory block

Usage

  `char *SLrealloc (char *ptr, unsigned int new_size)`

Description

  The `SLrealloc` uses the `realloc` function to resize the memory block specified by `ptr` to the new size `new_size`. If `ptr` is `NULL`, the function call is equivalent to `SLmalloc(new_size)`. Similarly, if `new_size` is zero, the function call is equivalent to `SLfree(ptr)`.

  If the function fails, or if `new_size` is zero, `NULL` is returned. Otherwise a pointer is returned to the (possibly moved) new block of memory.

See Also

  `SLfree, SLmalloc, SLcalloc`

Next Previous Contents