sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\nwdl.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __NWDL_H__ sl@0: #define __NWDL_H__ sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __NO_ALLOC_DECLARATIONS__ sl@0: #ifdef __KERNEL_MODE__ sl@0: #define __ALLOCATOR Kern sl@0: #else sl@0: #define __ALLOCATOR User sl@0: #endif sl@0: sl@0: GLDEF_C TAny *operator new(TUint aSize) __NO_THROW sl@0: // sl@0: // The global new operator. sl@0: // sl@0: { sl@0: #ifdef __USE_MALLOC__ sl@0: return malloc(aSize); sl@0: #else sl@0: return __ALLOCATOR::Alloc(aSize); sl@0: #endif sl@0: } sl@0: sl@0: GLDEF_C TAny *operator new[](TUint aSize) __NO_THROW sl@0: { sl@0: #ifdef __USE_MALLOC__ sl@0: return malloc(aSize); sl@0: #else sl@0: return __ALLOCATOR::Alloc(aSize); sl@0: #endif sl@0: } sl@0: sl@0: GLDEF_C TAny *operator new(TUint aSize, TUint anExtraSize) __NO_THROW sl@0: // sl@0: // Allocate the requested size plus the extra. sl@0: // sl@0: { sl@0: #ifdef __USE_MALLOC__ sl@0: return malloc(aSize+anExtraSize); sl@0: #else sl@0: return __ALLOCATOR::Alloc(aSize+anExtraSize); sl@0: #endif sl@0: } sl@0: sl@0: GLDEF_C void operator delete(TAny *aPtr) __NO_THROW sl@0: // sl@0: // The replacement delete operator. sl@0: // sl@0: { sl@0: #ifdef __USE_MALLOC__ sl@0: free(aPtr); sl@0: #else sl@0: __ALLOCATOR::Free(aPtr); sl@0: #endif sl@0: } sl@0: sl@0: GLDEF_C void operator delete[](TAny * aPtr) __NO_THROW sl@0: { sl@0: #ifdef __USE_MALLOC__ sl@0: free(aPtr); sl@0: #else sl@0: __ALLOCATOR::Free(aPtr); sl@0: #endif sl@0: } sl@0: #endif sl@0: #endif // #ifndef __NWDL_H__