5 void * rpl_realloc(void *ptr
, size_t size
)
8 if (size
<= 0){ /* For zero or less bytes, free the original memory */
12 else if (!ptr
) /* Allow reallocation of a NULL pointer. */
14 else { /* Allocate a new block, copy and free the old block. */
17 memcpy (mem
, ptr
, size
);
20 /* Note that the contents of PTR are not damaged if there is
21 insufficient memory to realloc. */