1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-14 09:50:05 +00:00
Laika/lib/src/lmem.c
CPunch 1bccc78117 First actual runnable version
- many warnings & bug fixes
- added bot/ source
2022-01-24 21:46:29 -06:00

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;
}