|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63009 - in trunk: boost/pool boost/pool/detail libs/pool/test
From: steven_at_[hidden]
Date: 2010-06-15 22:27:19
Author: steven_watanabe
Date: 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
New Revision: 63009
URL: http://svn.boost.org/trac/boost/changeset/63009
Log:
Protect Boost.Pool from evil #defines of malloc and free. Fixes #4346.
Text files modified:
trunk/boost/pool/detail/pool_construct.inc | 343 +++++++++++++++++++--------------------
trunk/boost/pool/detail/pool_construct.m4 | 4
trunk/boost/pool/detail/pool_construct_simple.inc | 12
trunk/boost/pool/detail/pool_construct_simple.m4 | 11
trunk/boost/pool/object_pool.hpp | 12
trunk/boost/pool/pool.hpp | 34 +-
trunk/boost/pool/pool_alloc.hpp | 20 +-
trunk/boost/pool/simple_segregated_storage.hpp | 6
trunk/boost/pool/singleton_pool.hpp | 12
trunk/libs/pool/test/test_pool_alloc.cpp | 14
10 files changed, 233 insertions(+), 235 deletions(-)
Modified: trunk/boost/pool/detail/pool_construct.inc
==============================================================================
--- trunk/boost/pool/detail/pool_construct.inc (original)
+++ trunk/boost/pool/detail/pool_construct.inc 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -1,853 +1,852 @@
// Copyright (C) 2000 Stephen Cleary
//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
+// Distributed under the Boost Software License, Version 1.0. (See accompany-
+// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
-// This file was AUTOMATICALLY GENERATED from "pool_c~1.m4"
+// This file was AUTOMATICALLY GENERATED from "stdin"
// Do NOT include directly!
// Do NOT edit!
template <typename T0>
element_type * construct(T0 & a0)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0>
element_type * construct(const T0 & a0)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0>
element_type * construct(volatile T0 & a0)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0>
element_type * construct(const volatile T0 & a0)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, const T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, const T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, const T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, const T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, const volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, const volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, const volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
Modified: trunk/boost/pool/detail/pool_construct.m4
==============================================================================
--- trunk/boost/pool/detail/pool_construct.m4 (original)
+++ trunk/boost/pool/detail/pool_construct.m4 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -74,11 +74,11 @@
element_type * construct(BOOST_M4_FOR(i, 0, N,
`cv_qual(m4_eval((cv >> (i * 2)) % 4))T`'i & a`'i', `, '))
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(BOOST_M4_FOR(i, 0, N, `a`'i', `, ')); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
')')
Modified: trunk/boost/pool/detail/pool_construct_simple.inc
==============================================================================
--- trunk/boost/pool/detail/pool_construct_simple.inc (original)
+++ trunk/boost/pool/detail/pool_construct_simple.inc 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -13,31 +13,31 @@
template <typename T0>
element_type * construct(const T0 & a0)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, const T1 & a1)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, const T2 & a2)
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
Modified: trunk/boost/pool/detail/pool_construct_simple.m4
==============================================================================
--- trunk/boost/pool/detail/pool_construct_simple.m4 (original)
+++ trunk/boost/pool/detail/pool_construct_simple.m4 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -40,10 +40,9 @@
m4_dnl
// Copyright (C) 2000 Stephen Cleary
//
-// This file can be redistributed and/or modified under the terms found
-// in "copyright.html"
-// This software and its documentation is provided "as is" without express or
-// implied warranty, and with no claim as to its suitability for any purpose.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
@@ -63,11 +62,11 @@
element_type * construct(BOOST_M4_FOR(i, 0, N,
`const T`'i & a`'i', `, '))
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(BOOST_M4_FOR(i, 0, N, `a`'i', `, ')); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
')
Modified: trunk/boost/pool/object_pool.hpp
==============================================================================
--- trunk/boost/pool/object_pool.hpp (original)
+++ trunk/boost/pool/object_pool.hpp 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -59,20 +59,20 @@
~object_pool();
// Returns 0 if out-of-memory
- element_type * malloc()
+ element_type * malloc BOOST_PREVENT_MACRO_SUBSTITUTION()
{ return static_cast<element_type *>(store().ordered_malloc()); }
- void free(element_type * const chunk)
+ void free BOOST_PREVENT_MACRO_SUBSTITUTION(element_type * const chunk)
{ store().ordered_free(chunk); }
bool is_from(element_type * const chunk) const
{ return store().is_from(chunk); }
element_type * construct()
{
- element_type * const ret = malloc();
+ element_type * const ret = (malloc)();
if (ret == 0)
return ret;
try { new (ret) element_type(); }
- catch (...) { free(ret); throw; }
+ catch (...) { (free)(ret); throw; }
return ret;
}
@@ -87,7 +87,7 @@
void destroy(element_type * const chunk)
{
chunk->~T();
- free(chunk);
+ (free)(chunk);
}
// These functions are extensions!
@@ -136,7 +136,7 @@
}
// free storage
- UserAllocator::free(iter.begin());
+ (UserAllocator::free)(iter.begin());
// increment iter
iter = next;
Modified: trunk/boost/pool/pool.hpp
==============================================================================
--- trunk/boost/pool/pool.hpp (original)
+++ trunk/boost/pool/pool.hpp 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -51,9 +51,9 @@
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
- static char * malloc(const size_type bytes)
+ static char * malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes)
{ return new (std::nothrow) char[bytes]; }
- static void free(char * const block)
+ static void free BOOST_PREVENT_MACRO_SUBSTITUTION(char * const block)
{ delete [] block; }
};
@@ -62,9 +62,9 @@
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
- static char * malloc(const size_type bytes)
+ static char * malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes)
{ return static_cast<char *>(std::malloc(bytes)); }
- static void free(char * const block)
+ static void free BOOST_PREVENT_MACRO_SUBSTITUTION(char * const block)
{ std::free(block); }
};
@@ -218,11 +218,11 @@
// free chunks. Only if we need to get another memory block do we call
// the non-inlined *_need_resize() functions.
// Returns 0 if out-of-memory
- void * malloc()
+ void * malloc BOOST_PREVENT_MACRO_SUBSTITUTION()
{
// Look for a non-empty storage
if (!store().empty())
- return store().malloc();
+ return (store().malloc)();
return malloc_need_resize();
}
@@ -230,7 +230,7 @@
{
// Look for a non-empty storage
if (!store().empty())
- return store().malloc();
+ return (store().malloc)();
return ordered_malloc_need_resize();
}
@@ -240,8 +240,8 @@
// pre: 'chunk' must have been previously
// returned by *this.malloc().
- void free(void * const chunk)
- { store().free(chunk); }
+ void free BOOST_PREVENT_MACRO_SUBSTITUTION(void * const chunk)
+ { (store().free)(chunk); }
// pre: 'chunk' must have been previously
// returned by *this.malloc().
@@ -250,7 +250,7 @@
// pre: 'chunk' must have been previously
// returned by *this.malloc(n).
- void free(void * const chunks, const size_type n)
+ void free BOOST_PREVENT_MACRO_SUBSTITUTION(void * const chunks, const size_type n)
{
const size_type partition_size = alloc_size();
const size_type total_req_size = n * requested_size;
@@ -390,7 +390,7 @@
this->first = free_p;
// And release memory
- UserAllocator::free(ptr.begin());
+ (UserAllocator::free)(ptr.begin());
ret = true;
}
@@ -416,7 +416,7 @@
const details::PODptr<size_type> next = iter.next();
// delete the storage
- UserAllocator::free(iter.begin());
+ (UserAllocator::free)(iter.begin());
// increment iter
iter = next;
@@ -436,7 +436,7 @@
const size_type partition_size = alloc_size();
const size_type POD_size = next_size * partition_size +
details::pool::ct_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type);
- char * const ptr = UserAllocator::malloc(POD_size);
+ char * const ptr = (UserAllocator::malloc)(POD_size);
if (ptr == 0)
return 0;
const details::PODptr<size_type> node(ptr, POD_size);
@@ -450,7 +450,7 @@
list = node;
// and return a chunk from it.
- return store().malloc();
+ return (store().malloc)();
}
template <typename UserAllocator>
@@ -460,7 +460,7 @@
const size_type partition_size = alloc_size();
const size_type POD_size = next_size * partition_size +
details::pool::ct_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type);
- char * const ptr = UserAllocator::malloc(POD_size);
+ char * const ptr = (UserAllocator::malloc)(POD_size);
if (ptr == 0)
return 0;
const details::PODptr<size_type> node(ptr, POD_size);
@@ -499,7 +499,7 @@
}
// and return a chunk from it.
- return store().malloc();
+ return (store().malloc)();
}
template <typename UserAllocator>
@@ -520,7 +520,7 @@
next_size = max BOOST_PREVENT_MACRO_SUBSTITUTION(next_size, num_chunks);
const size_type POD_size = next_size * partition_size +
details::pool::ct_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type);
- char * const ptr = UserAllocator::malloc(POD_size);
+ char * const ptr = (UserAllocator::malloc)(POD_size);
if (ptr == 0)
return 0;
const details::PODptr<size_type> node(ptr, POD_size);
Modified: trunk/boost/pool/pool_alloc.hpp
==============================================================================
--- trunk/boost/pool/pool_alloc.hpp (original)
+++ trunk/boost/pool/pool_alloc.hpp 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -222,8 +222,8 @@
{
const pointer ret = (n == 1) ?
static_cast<pointer>(
- singleton_pool<fast_pool_allocator_tag, sizeof(T),
- UserAllocator, Mutex, NextSize>::malloc() ) :
+ (singleton_pool<fast_pool_allocator_tag, sizeof(T),
+ UserAllocator, Mutex, NextSize>::malloc)() ) :
static_cast<pointer>(
singleton_pool<fast_pool_allocator_tag, sizeof(T),
UserAllocator, Mutex, NextSize>::ordered_malloc(n) );
@@ -236,8 +236,8 @@
static pointer allocate()
{
const pointer ret = static_cast<pointer>(
- singleton_pool<fast_pool_allocator_tag, sizeof(T),
- UserAllocator, Mutex, NextSize>::malloc() );
+ (singleton_pool<fast_pool_allocator_tag, sizeof(T),
+ UserAllocator, Mutex, NextSize>::malloc)() );
if (ret == 0)
boost::throw_exception(std::bad_alloc());
return ret;
@@ -249,16 +249,16 @@
return;
#endif
if (n == 1)
- singleton_pool<fast_pool_allocator_tag, sizeof(T),
- UserAllocator, Mutex, NextSize>::free(ptr);
+ (singleton_pool<fast_pool_allocator_tag, sizeof(T),
+ UserAllocator, Mutex, NextSize>::free)(ptr);
else
- singleton_pool<fast_pool_allocator_tag, sizeof(T),
- UserAllocator, Mutex, NextSize>::free(ptr, n);
+ (singleton_pool<fast_pool_allocator_tag, sizeof(T),
+ UserAllocator, Mutex, NextSize>::free)(ptr, n);
}
static void deallocate(const pointer ptr)
{
- singleton_pool<fast_pool_allocator_tag, sizeof(T),
- UserAllocator, Mutex, NextSize>::free(ptr);
+ (singleton_pool<fast_pool_allocator_tag, sizeof(T),
+ UserAllocator, Mutex, NextSize>::free)(ptr);
}
};
Modified: trunk/boost/pool/simple_segregated_storage.hpp
==============================================================================
--- trunk/boost/pool/simple_segregated_storage.hpp (original)
+++ trunk/boost/pool/simple_segregated_storage.hpp 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -96,7 +96,7 @@
bool empty() const { return (first == 0); }
// pre: !empty()
- void * malloc()
+ void * malloc BOOST_PREVENT_MACRO_SUBSTITUTION()
{
void * const ret = first;
@@ -108,7 +108,7 @@
// pre: chunk was previously returned from a malloc() referring to the
// same free list
// post: !empty()
- void free(void * const chunk)
+ void free BOOST_PREVENT_MACRO_SUBSTITUTION(void * const chunk)
{
nextof(chunk) = first;
first = chunk;
@@ -127,7 +127,7 @@
// Place either at beginning or in middle/end
if (loc == 0)
- free(chunk);
+ (free)(chunk);
else
{
nextof(chunk) = nextof(loc);
Modified: trunk/boost/pool/singleton_pool.hpp
==============================================================================
--- trunk/boost/pool/singleton_pool.hpp (original)
+++ trunk/boost/pool/singleton_pool.hpp 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -52,11 +52,11 @@
singleton_pool();
public:
- static void * malloc()
+ static void * malloc BOOST_PREVENT_MACRO_SUBSTITUTION()
{
pool_type & p = singleton::instance();
details::pool::guard<Mutex> g(p);
- return p.p.malloc();
+ return (p.p.malloc)();
}
static void * ordered_malloc()
{
@@ -76,11 +76,11 @@
details::pool::guard<Mutex> g(p);
return p.p.is_from(ptr);
}
- static void free(void * const ptr)
+ static void free BOOST_PREVENT_MACRO_SUBSTITUTION(void * const ptr)
{
pool_type & p = singleton::instance();
details::pool::guard<Mutex> g(p);
- p.p.free(ptr);
+ (p.p.free)(ptr);
}
static void ordered_free(void * const ptr)
{
@@ -88,11 +88,11 @@
details::pool::guard<Mutex> g(p);
p.p.ordered_free(ptr);
}
- static void free(void * const ptr, const size_type n)
+ static void free BOOST_PREVENT_MACRO_SUBSTITUTION(void * const ptr, const size_type n)
{
pool_type & p = singleton::instance();
details::pool::guard<Mutex> g(p);
- p.p.free(ptr, n);
+ (p.p.free)(ptr, n);
}
static void ordered_free(void * const ptr, const size_type n)
{
Modified: trunk/libs/pool/test/test_pool_alloc.cpp
==============================================================================
--- trunk/libs/pool/test/test_pool_alloc.cpp (original)
+++ trunk/libs/pool/test/test_pool_alloc.cpp 2010-06-15 22:27:17 EDT (Tue, 15 Jun 2010)
@@ -236,18 +236,18 @@
static std::set<char *> allocated_blocks;
- static char * malloc(const size_type bytes)
+ static char * malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes)
{
- char * const ret = UserAllocator::malloc(bytes);
+ char * const ret = (UserAllocator::malloc)(bytes);
allocated_blocks.insert(ret);
return ret;
}
- static void free(char * const block)
+ static void free BOOST_PREVENT_MACRO_SUBSTITUTION(char * const block)
{
if (allocated_blocks.find(block) == allocated_blocks.end())
std::cout << "Free'd non-malloc'ed block: " << (void *) block << std::endl;
allocated_blocks.erase(block);
- UserAllocator::free(block);
+ (UserAllocator::free)(block);
}
static bool ok() { return allocated_blocks.empty(); }
@@ -276,7 +276,7 @@
std::cout << "Pool purged memory" << std::endl;
// Should allocate from system
- pool.free(pool.malloc());
+ (pool.free)((pool.malloc)());
if (track_alloc::ok())
std::cout << "Memory error" << std::endl;
@@ -287,7 +287,7 @@
std::cout << "Memory error" << std::endl;
// Should allocate from system again
- pool.malloc(); // loses the pointer to the returned chunk (*A*)
+ (pool.malloc)(); // loses the pointer to the returned chunk (*A*)
// Ask pool to give up memory it's not using; this should fail
if (pool.release_memory())
@@ -301,7 +301,7 @@
std::cout << "Memory error" << std::endl;
// Should allocate from system again
- pool.malloc(); // loses the pointer to the returned chunk (*B*)
+ (pool.malloc)(); // loses the pointer to the returned chunk (*B*)
// pool's destructor should purge the memory
// This will clean up the memory leak from (*B*)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk