2003-07-23 22:09:17 +00:00
|
|
|
/*
|
|
|
|
* HeapCheck - a heap debugging library
|
|
|
|
* Copyright (C) 2001 Thanassis Tsiodras (ttsiod@softlab.ntua.gr)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
// We only exist in debug builds...
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "HeapCheckPrototypes.h"
|
|
|
|
|
|
|
|
// Checks for underuns...
|
|
|
|
#ifdef PRE_CHECK
|
|
|
|
|
|
|
|
void *operator new(size_t size)
|
|
|
|
{
|
|
|
|
return HeapCheckPreFenceMalloc(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void *operator new[](size_t size)
|
|
|
|
{
|
|
|
|
return HeapCheckPreFenceMalloc(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator delete(void *p)
|
|
|
|
{
|
|
|
|
if (p)
|
|
|
|
HeapCheckPreFenceFree(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator delete[](void *p)
|
|
|
|
{
|
|
|
|
if (p)
|
|
|
|
HeapCheckPreFenceFree(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// Checks for overuns...
|
|
|
|
void *operator new(size_t size)
|
|
|
|
{
|
|
|
|
return HeapCheckPostFenceMalloc(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void *operator new[](size_t size)
|
|
|
|
{
|
|
|
|
return HeapCheckPostFenceMalloc(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator delete(void *p)
|
|
|
|
{
|
|
|
|
if (p)
|
|
|
|
HeapCheckPostFenceFree(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator delete[](void *p)
|
|
|
|
{
|
|
|
|
if (p)
|
|
|
|
HeapCheckPostFenceFree(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* PRE_CHECK */
|
|
|
|
|
|
|
|
#endif /* _DEBUG */
|
|
|
|
|
|
|
|
#endif /* __cplusplus */
|
2004-12-08 00:40:19 +00:00
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
static volatile const char __attribute__((unused)) *BOINCrcsid="$Id$";
|
|
|
|
#else
|
|
|
|
static volatile const char *BOINCrcsid="$Id$";
|
|
|
|
#endif
|