campo-sirio/xi/xiheap.c

60 lines
1.3 KiB
C
Raw Normal View History

/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define XI_INTERNAL
#include "xi.h"
#include "xiheap.h"
#ifdef DEBUG
int nbr_malloc,
nbr_free;
#endif
void *
heap_malloc( size_t size )
{
void *p;
#ifdef DEBUG
nbr_malloc++;
#endif
p = XinMemoryAlloc( size );
if ( p != NULL )
memset( ( char * ) p, '\0', ( size_t ) size );
return ( p );
}
void
heap_free( void *p )
{
#ifdef DEBUG
nbr_free++;
#endif
XinMemoryFree( ( char * ) p );
}
void *
heap_realloc( void *p, size_t size )
{
return ( XinMemoryRealloc( ( char * ) p, size ) );
}
void
heap_dbg( char *title )
{
#ifdef DEBUG
XinDebugPrintf( "heap check (%Fs): malloc's=%u, free's=%u", title, nbr_malloc, nbr_free );
#else
NOREF( title );
#endif
}