tests: Remove new/delete overrides (all pugi code now uses custom allocators)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@668 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
f711006e80
commit
84dce2eb46
@ -1,11 +1,8 @@
|
|||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
#include "allocator.hpp"
|
#include "allocator.hpp"
|
||||||
|
|
||||||
#include <new>
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <float.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
test_runner* test_runner::_tests = 0;
|
test_runner* test_runner::_tests = 0;
|
||||||
@ -53,60 +50,6 @@ static void replace_memory_management()
|
|||||||
pugi::set_memory_management_functions(custom_allocate, custom_deallocate);
|
pugi::set_memory_management_functions(custom_allocate, custom_deallocate);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
|
||||||
#define DECL_THROW(e) throw(e)
|
|
||||||
#define DECL_NOTHROW() throw()
|
|
||||||
#else
|
|
||||||
#define DECL_THROW(e)
|
|
||||||
#define DECL_NOTHROW()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void* operator new(size_t size) DECL_THROW(std::bad_alloc)
|
|
||||||
{
|
|
||||||
void* result = custom_allocate(size);
|
|
||||||
|
|
||||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
|
||||||
if (!result) throw std::bad_alloc();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new[](size_t size) DECL_THROW(std::bad_alloc)
|
|
||||||
{
|
|
||||||
return operator new(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new(size_t size, const std::nothrow_t&) throw()
|
|
||||||
{
|
|
||||||
return custom_allocate(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new[](size_t size, const std::nothrow_t&) throw()
|
|
||||||
{
|
|
||||||
return custom_allocate(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void* ptr) DECL_NOTHROW()
|
|
||||||
{
|
|
||||||
if (ptr) custom_deallocate(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete[](void* ptr) DECL_NOTHROW()
|
|
||||||
{
|
|
||||||
if (ptr) custom_deallocate(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void* ptr, const std::nothrow_t&) throw()
|
|
||||||
{
|
|
||||||
if (ptr) custom_deallocate(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete[](void* ptr, const std::nothrow_t&) throw()
|
|
||||||
{
|
|
||||||
if (ptr) custom_deallocate(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER > 1200 && _MSC_VER < 1400 && !defined(__INTEL_COMPILER) && !defined(__DMC__)
|
#if defined(_MSC_VER) && _MSC_VER > 1200 && _MSC_VER < 1400 && !defined(__INTEL_COMPILER) && !defined(__DMC__)
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
@ -181,11 +124,6 @@ int main()
|
|||||||
_control87(MCW_EM | PC_53, MCW_EM | MCW_PC);
|
_control87(MCW_EM | PC_53, MCW_EM | MCW_PC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__GNUC__)
|
|
||||||
std::cout.flush();
|
|
||||||
std::wcout.flush();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
replace_memory_management();
|
replace_memory_management();
|
||||||
|
|
||||||
unsigned int total = 0;
|
unsigned int total = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user