ft_alloc( FT_Memory memory, long size ) { FT_UNUSED( memory ); return ft_smalloc( size ); }
void *ft_srealloc( void *ptr, size_t size ) { #ifdef SIM_PC_WIN return esMEMS_Realloc(NULL, ptr, size); #else char *p; char *src; size_t i; if( ptr == NULL && size == 0 ) return NULL; if( ptr == NULL ) { p = (char *)ft_smalloc( size ); return p; } if( size == 0 ) { ft_sfree( ptr ); return NULL; } p = (char *)ft_smalloc( size ); if( p == NULL ) return NULL; for( src = (char *)ptr, i = 0; i < size; i++ ) { p[i] = src[i]; } ft_sfree( ptr ); return p; #endif }
FT_New_Memory( void ) { FT_Memory memory; memory = (FT_Memory)ft_smalloc( sizeof ( *memory ) ); if ( memory ) { memory->user = 0; memory->alloc = ft_alloc; memory->realloc = ft_realloc; memory->free = ft_free; #ifdef FT_DEBUG_MEMORY ft_mem_debug_init( memory ); #endif } return memory; }