os/kernelhwsrv/kernel/eka/include/nwdl.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/nwdl.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\nwdl.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __NWDL_H__
    1.22 +#define __NWDL_H__
    1.23 +
    1.24 +/**
    1.25 +@file
    1.26 +@internalTechnology
    1.27 +*/
    1.28 +
    1.29 +#ifndef __NO_ALLOC_DECLARATIONS__
    1.30 +#ifdef __KERNEL_MODE__
    1.31 +#define __ALLOCATOR Kern
    1.32 +#else
    1.33 +#define __ALLOCATOR User
    1.34 +#endif
    1.35 +
    1.36 +GLDEF_C TAny *operator new(TUint aSize) __NO_THROW
    1.37 +//
    1.38 +// The global new operator.
    1.39 +//
    1.40 +	{
    1.41 +#ifdef __USE_MALLOC__
    1.42 +	return malloc(aSize);
    1.43 +#else
    1.44 +	return __ALLOCATOR::Alloc(aSize);
    1.45 +#endif
    1.46 +	}
    1.47 +
    1.48 +GLDEF_C TAny *operator new[](TUint aSize) __NO_THROW
    1.49 +    {
    1.50 +#ifdef __USE_MALLOC__
    1.51 +	return malloc(aSize);
    1.52 +#else
    1.53 +	return __ALLOCATOR::Alloc(aSize);
    1.54 +#endif
    1.55 +    }
    1.56 +
    1.57 +GLDEF_C TAny *operator new(TUint aSize, TUint anExtraSize) __NO_THROW
    1.58 +//
    1.59 +// Allocate the requested size plus the extra.
    1.60 +//
    1.61 +	{
    1.62 +#ifdef __USE_MALLOC__
    1.63 +	return malloc(aSize+anExtraSize);
    1.64 +#else
    1.65 +	return __ALLOCATOR::Alloc(aSize+anExtraSize);
    1.66 +#endif
    1.67 +	}
    1.68 +
    1.69 +GLDEF_C void operator delete(TAny *aPtr) __NO_THROW
    1.70 +//
    1.71 +// The replacement delete operator.
    1.72 +//
    1.73 +	{
    1.74 +#ifdef __USE_MALLOC__
    1.75 +	free(aPtr);
    1.76 +#else
    1.77 +	__ALLOCATOR::Free(aPtr);
    1.78 +#endif
    1.79 +	}
    1.80 +
    1.81 +GLDEF_C void operator delete[](TAny * aPtr) __NO_THROW
    1.82 +    {
    1.83 +#ifdef __USE_MALLOC__
    1.84 +	free(aPtr);
    1.85 +#else
    1.86 +	__ALLOCATOR::Free(aPtr);
    1.87 +#endif
    1.88 +    }
    1.89 +#endif
    1.90 +#endif // #ifndef __NWDL_H__