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 : new_handler.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 _LIT(K,"set_new_handler");
36 using std::new_handler;
38 #ifdef __SYMBIAN_STDCPP_SUPPORT__
40 EXPORT_C new_handler std::set_new_handler(new_handler a_new_nh) __NO_THROW
42 new_handler current_nh;
43 TAny* tls_word_p = Dll::Tls();
47 // This is the first time we're called, so we need to set up the TLS.
49 tls_word_p = User::Alloc( sizeof(new_handler) );
52 User::Panic(K, KErrNoMemory);
55 Dll::SetTls(tls_word_p);
60 // Get the currently installed new_handler function.
61 current_nh = *reinterpret_cast<new_handler*>(tls_word_p);
64 // Set the new new_handler.
65 *reinterpret_cast<new_handler*>(tls_word_p) = a_new_nh;
70 #endif // __SYMBIAN_STDCPP_SUPPORT__