checking of ulSize == 0, no matter how HB_FM_STATISTICS may be.

Also added for hb_xalloc()
This commit is contained in:
Antonio Linares
2002-01-06 13:22:48 +00:00
parent 108178c353
commit 1db8dca0ae

View File

@@ -113,6 +113,7 @@ static PHB_MEMINFO s_pLastBlock = NULL;
void HB_EXPORT * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, returns NULL on failure */
{
#ifdef HB_FM_STATISTICS
void * pMem;
@@ -122,6 +123,9 @@ void HB_EXPORT * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, re
*/
HB_TRACE_STEALTH(HB_TR_DEBUG, ("hb_xalloc(%lu)", ulSize));
if( ulSize == 0 )
hb_errInternal( HB_EI_XALLOCNULLSIZE, NULL, NULL, NULL );
pMem = malloc( ulSize + sizeof( HB_MEMINFO ) + sizeof( ULONG ) );
if( ! pMem )
@@ -185,6 +189,9 @@ void HB_EXPORT * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, re
HB_TRACE(HB_TR_DEBUG, ("hb_xalloc(%lu)", ulSize));
if( ulSize == 0 )
hb_errInternal( HB_EI_XALLOCNULLSIZE, NULL, NULL, NULL );
return malloc( ulSize );
#endif
@@ -199,11 +206,11 @@ void HB_EXPORT * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exi
*/
HB_TRACE_STEALTH(HB_TR_DEBUG, ("hb_xgrab(%lu)", ulSize));
#ifdef HB_FM_STATISTICS
if( ulSize == 0 )
hb_errInternal( HB_EI_XGRABNULLSIZE, NULL, NULL, NULL );
#ifdef HB_FM_STATISTICS
pMem = malloc( ulSize + sizeof( HB_MEMINFO ) + sizeof( ULONG ) );
if( ! pMem )
@@ -335,6 +342,9 @@ void HB_EXPORT * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates m
if( ! pMem )
hb_errInternal( HB_EI_XREALLOCNULL, NULL, NULL, NULL );
if( ulSize == 0 )
hb_errInternal( HB_EI_XREALLOCNULLSIZE, NULL, NULL, NULL );
pMem = realloc( pMem, ulSize );
if( ! pMem )