/*
 * The UDS Collection
 * Copyright (C) 2000, 2001  Julian v. Bock
 *
 * 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
 *
 *	(See file COPYING for more information)
 */


// includes

#include <uds/alloc.hh>
#include <uds/uds.hh>
#include <string>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

using namespace std;


namespace uds
{

string TmpFileName_Prefix = "/tmp/uds";

/// the flags are set according to the macros defined in config.h
uds_flags_t flags = 0
#ifdef UDS_FORCE_CORE_DUMPS
	| force_core_dumps
#endif
#ifdef UDS_LEAK_CHECK
	| leak_check
#endif
#ifdef UDS_SUMMON_ZOMBIES
	| summon_zombies
#endif
#ifdef UDS_LOG_ALLOCS
	| log_allocs
#endif
#ifdef UDS_RENAME_UDS_CORES
	| rename_cores
#endif
#ifdef UDS_STD_BACKTRACES
	| std_backtraces
#endif
	;
}

#if !defined UDS_LEAK_CHECK && !defined UDS_SUMMON_ZOMBIES && !defined UDS_LOG_ALLOCS

extern "C" void
free( void* );

void*
operator new ( size_t size )
{
	return uds::original_new( size );
}

void*
operator new [] ( size_t size )
{
	return uds::original_new( size );
}

void
operator delete ( void* p )
{
	if ( p ) free( p );
}

void
operator delete [] ( void* p )
{
	if ( p ) free( p );
}

#endif
