58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
|
/*******************************************************************************
|
||
|
* Copyright 1991-1995 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 = malloc(size);
|
||
|
if ( p != NULL )
|
||
|
memset((char *)p, '\0', (size_t)size);
|
||
|
return(p);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
heap_free(void *p)
|
||
|
{
|
||
|
#ifdef DEBUG
|
||
|
nbr_free++;
|
||
|
#endif
|
||
|
free((char *)p);
|
||
|
}
|
||
|
|
||
|
void *
|
||
|
heap_realloc(void *p, size_t size)
|
||
|
{
|
||
|
return( realloc((char *)p, size ));
|
||
|
}
|
||
|
|
||
|
void
|
||
|
heap_dbg(char *title)
|
||
|
{
|
||
|
#ifdef DEBUG
|
||
|
xvt_debug_printf("heap check (%s): malloc's=%u, free's=%u", title, nbr_malloc, nbr_free);
|
||
|
#else
|
||
|
NOREF(title);
|
||
|
#endif
|
||
|
}
|
||
|
|