kernel/eka/include/nwdl.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2008-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 the License "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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\nwdl.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __NWDL_H__
       
    19 #define __NWDL_H__
       
    20 
       
    21 /**
       
    22 @file
       
    23 @internalTechnology
       
    24 */
       
    25 
       
    26 #ifndef __NO_ALLOC_DECLARATIONS__
       
    27 #ifdef __KERNEL_MODE__
       
    28 #define __ALLOCATOR Kern
       
    29 #else
       
    30 #define __ALLOCATOR User
       
    31 #endif
       
    32 
       
    33 GLDEF_C TAny *operator new(TUint aSize) __NO_THROW
       
    34 //
       
    35 // The global new operator.
       
    36 //
       
    37 	{
       
    38 #ifdef __USE_MALLOC__
       
    39 	return malloc(aSize);
       
    40 #else
       
    41 	return __ALLOCATOR::Alloc(aSize);
       
    42 #endif
       
    43 	}
       
    44 
       
    45 GLDEF_C TAny *operator new[](TUint aSize) __NO_THROW
       
    46     {
       
    47 #ifdef __USE_MALLOC__
       
    48 	return malloc(aSize);
       
    49 #else
       
    50 	return __ALLOCATOR::Alloc(aSize);
       
    51 #endif
       
    52     }
       
    53 
       
    54 GLDEF_C TAny *operator new(TUint aSize, TUint anExtraSize) __NO_THROW
       
    55 //
       
    56 // Allocate the requested size plus the extra.
       
    57 //
       
    58 	{
       
    59 #ifdef __USE_MALLOC__
       
    60 	return malloc(aSize+anExtraSize);
       
    61 #else
       
    62 	return __ALLOCATOR::Alloc(aSize+anExtraSize);
       
    63 #endif
       
    64 	}
       
    65 
       
    66 GLDEF_C void operator delete(TAny *aPtr) __NO_THROW
       
    67 //
       
    68 // The replacement delete operator.
       
    69 //
       
    70 	{
       
    71 #ifdef __USE_MALLOC__
       
    72 	free(aPtr);
       
    73 #else
       
    74 	__ALLOCATOR::Free(aPtr);
       
    75 #endif
       
    76 	}
       
    77 
       
    78 GLDEF_C void operator delete[](TAny * aPtr) __NO_THROW
       
    79     {
       
    80 #ifdef __USE_MALLOC__
       
    81 	free(aPtr);
       
    82 #else
       
    83 	__ALLOCATOR::Free(aPtr);
       
    84 #endif
       
    85     }
       
    86 #endif
       
    87 #endif // #ifndef __NWDL_H__