Update contrib.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Name : operator_new.cpp
15 // Part of : libstdcpp
16 // Adaptation layer to get locale functionality.
18 // This material, including documentation and any related
19 // computer programs, is protected by copyright controlled by
20 // Nokia Corporation. All rights are reserved. Copying,
21 // including reproducing, storing, adapting or translating, any
22 // or all of this material requires the prior written consent of
23 // Nokia Corporation. This material also contains confidential
24 // information which may not be disclosed to others without the
25 // prior written consent of Nokia Corporation.
33 #ifdef __SYMBIAN_STDCPP_SUPPORT__
35 EXPORT_C void* operator new(std::size_t a_size) __THROW(std::bad_alloc)
39 void* p = User::Alloc(a_size);
46 std::new_handler nh_func ;
47 std::new_handler *ptr = reinterpret_cast<std::new_handler*>(Dll::Tls());
48 nh_func = (ptr)?(*ptr):NULL;
56 __THROW(std::bad_alloc());
61 EXPORT_C void* operator new[](std::size_t a_size) __THROW(std::bad_alloc)
63 return ::operator new(a_size);
66 EXPORT_C void* operator new(std::size_t a_size, const std::nothrow_t&) __NO_THROW
70 void* p = User::Alloc(a_size);
77 std::new_handler nh_func ;
78 std::new_handler *ptr = reinterpret_cast<std::new_handler*>(Dll::Tls());
79 nh_func = (ptr)?(*ptr):NULL;
99 EXPORT_C void* operator new[](std::size_t a_size, const std::nothrow_t&) __NO_THROW
101 return ::operator new(a_size, std::nothrow);
104 // Symbian-specific addition.
105 EXPORT_C void* operator new(std::size_t a_size, std::size_t a_extra_size) __NO_THROW
107 return User::Alloc(a_size + a_extra_size);
111 //TODO: MOVE to another file
112 EXPORT_C std::bad_alloc::bad_alloc() __NO_THROW
114 EXPORT_C std::bad_alloc::bad_alloc(const std::bad_alloc&) __NO_THROW
116 EXPORT_C std::bad_alloc& std::bad_alloc::operator=(const std::bad_alloc&) __NO_THROW
118 EXPORT_C std::bad_alloc::~bad_alloc() __NO_THROW
120 EXPORT_C const char* std::bad_alloc::what() const __NO_THROW
121 { return "bad_alloc";}
124 #endif // __SYMBIAN_STDCPP_SUPPORT__