mirror of
https://github.com/CPunch/Laika.git
synced 2024-11-14 09:50:05 +00:00
18 lines
384 B
C
18 lines
384 B
C
#include "lerror.h"
|
|
#include "lmem.h"
|
|
|
|
void *laikaM_realloc(void *buf, size_t sz) {
|
|
void *newBuf;
|
|
|
|
/* are we free'ing the buffer? */
|
|
if (sz == 0) {
|
|
free(buf);
|
|
return NULL;
|
|
}
|
|
|
|
/* if NULL is passed, realloc() acts like malloc() */
|
|
if ((newBuf = realloc(buf, sz)) == NULL)
|
|
LAIKA_ERROR("failed to allocate memory!\n");
|
|
|
|
return newBuf;
|
|
} |