Benoît Minisini ba19f3c1dd * Copy https://gambas.svn.sourceforge.net/svnroot/gambas/2.0 to https://gambas.svn.sourceforge.net/svnroot/gambas/gambas
git-svn-id: svn://localhost/gambas/trunk@893 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2007-12-30 16:41:49 +00:00

43 lines
725 B
C++

#include <glib.h>
#include "main.h"
#include "gambas.h"
#include <stdio.h>
gpointer gMalloc (gsize n_bytes)
{
gpointer *ptr;
GB.Alloc((void**)POINTER(&ptr), n_bytes);
return ptr;
}
gpointer gRealloc (gpointer mem,gsize n_bytes)
{
GB.Realloc((void**)POINTER(&mem), n_bytes);
return mem;
}
void gFree (gpointer mem)
{
gpointer ptr = mem;
GB.Free((void**)POINTER(&ptr));
}
void setGeneralMemoryHandler()
{
GMemVTable general_memory_table;
general_memory_table.malloc=gMalloc;
general_memory_table.realloc=gRealloc;
general_memory_table.free=gFree;
general_memory_table.calloc=NULL;
general_memory_table.try_malloc=NULL;
general_memory_table.try_realloc=NULL;
g_mem_set_vtable(&general_memory_table);
}