sl@0: // Copyright (c) 1998-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 "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: // sl@0: // sl@0: sl@0: #include sl@0: #include //size_t sl@0: #include sl@0: sl@0: // We use the EPOC32 memory allocation which is already sl@0: // thread-safe, so we don't need the _malloc_r variants sl@0: sl@0: extern "C" { sl@0: sl@0: EXPORT_C void* malloc (size_t nbytes) sl@0: { sl@0: if (nbytes >= (KMaxTInt/2)) sl@0: { sl@0: errno = ENOMEM; sl@0: return NULL; sl@0: } sl@0: sl@0: TAny *Tptr = User::Alloc(nbytes); sl@0: if(Tptr == NULL) sl@0: errno = ENOMEM; sl@0: sl@0: return Tptr; sl@0: } sl@0: sl@0: EXPORT_C void* realloc (void *p, size_t nbytes) sl@0: { sl@0: if (nbytes >= (KMaxTInt/2)) sl@0: { sl@0: errno = ENOMEM; sl@0: return NULL; sl@0: } sl@0: sl@0: TAny *Tptr = User::ReAlloc(p, nbytes); sl@0: if(Tptr == NULL) sl@0: errno = ENOMEM; sl@0: sl@0: return Tptr; sl@0: } sl@0: sl@0: EXPORT_C void free (void *p) sl@0: { sl@0: User::Free(p); sl@0: } sl@0: sl@0: } // extern "C"