1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-14 18:00:09 +00:00
Laika/lib/src/lmem.c

19 lines
435 B
C
Raw Normal View History

#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) {
if (buf != NULL) /* sanity check :) */
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;
}