1994-11-16 20:39:16 +03:00
|
|
|
/*
|
|
|
|
** mem.c
|
|
|
|
** TecCGraf - PUC-Rio
|
|
|
|
*/
|
|
|
|
|
1994-11-16 21:09:11 +03:00
|
|
|
char *rcs_mem = "$Id: mem.c,v 1.1 1994/11/16 17:38:08 roberto Exp $";
|
1994-11-16 20:39:16 +03:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "mem.h"
|
|
|
|
#include "lua.h"
|
|
|
|
|
|
|
|
void luaI_free (void *block)
|
|
|
|
{
|
1994-11-16 21:09:11 +03:00
|
|
|
*((int *)block) = -1; /* to catch errors */
|
1994-11-16 20:39:16 +03:00
|
|
|
free(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void *luaI_malloc (unsigned long size)
|
|
|
|
{
|
|
|
|
void *block = malloc(size);
|
|
|
|
if (block == NULL)
|
|
|
|
lua_error("not enough memory");
|
|
|
|
return block;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void *luaI_realloc (void *oldblock, unsigned long size)
|
|
|
|
{
|
|
|
|
void *block = realloc(oldblock, size);
|
|
|
|
if (block == NULL)
|
|
|
|
lua_error("not enough memory");
|
|
|
|
return block;
|
|
|
|
}
|
|
|
|
|