]> git.ipfire.org Git - thirdparty/squid.git/blob - include/SquidNew.h
Merged from trunk
[thirdparty/squid.git] / include / SquidNew.h
1 /*
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_NEW_H
10 #define SQUID_NEW_H
11
12 #if !defined(__SUNPRO_CC) && !defined(__clang__)
13 /* Any code using libstdc++ must have externally resolvable overloads
14 * for void * operator new - which means in the .o for the binary,
15 * or in a shared library. static libs don't propogate the symbol
16 * so, look in the translation unit containing main() in squid
17 * for the extern version in squid
18 */
19 #include <new>
20
21 _SQUID_EXTERNNEW_ void *operator new(size_t size) throw (std::bad_alloc)
22 {
23 return xmalloc(size);
24 }
25 _SQUID_EXTERNNEW_ void operator delete (void *address) throw()
26 {
27 xfree(address);
28 }
29 _SQUID_EXTERNNEW_ void *operator new[] (size_t size) throw (std::bad_alloc)
30 {
31 return xmalloc(size);
32 }
33 _SQUID_EXTERNNEW_ void operator delete[] (void *address) throw()
34 {
35 xfree(address);
36 }
37
38 #endif /* !__SUNPRO_CC && !__clang__*/
39
40 #endif /* SQUID_NEW_H */
41