mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:02:56 +00:00
revert of mass delete of the posix subsystem. perhaps there is hope for it yet.
svn path=/trunk/; revision=3674
This commit is contained in:
parent
c29a543da5
commit
385fdfdfeb
166 changed files with 20265 additions and 0 deletions
55
posix/lib/psxdll/stdlib/malloc.c
Normal file
55
posix/lib/psxdll/stdlib/malloc.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* $Id: malloc.c,v 1.4 2002/10/29 04:45:41 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS POSIX+ Subsystem
|
||||
* FILE: subsys/psx/lib/psxdll/stdlib/malloc.c
|
||||
* PURPOSE: Memory allocator
|
||||
* PROGRAMMER: KJK::Hyperion <noog@libero.it>
|
||||
* UPDATE HISTORY:
|
||||
* 27/12/2001: Created
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <psx/stdlib.h>
|
||||
|
||||
void * malloc(size_t size)
|
||||
{
|
||||
void * pTemp = __malloc(size);
|
||||
|
||||
if(!pTemp)
|
||||
errno = ENOMEM;
|
||||
|
||||
return (pTemp);
|
||||
}
|
||||
|
||||
void free(void * ptr)
|
||||
{
|
||||
__free(ptr);
|
||||
}
|
||||
|
||||
void * calloc(size_t nelem, size_t elsize)
|
||||
{
|
||||
return (__malloc(nelem * elsize));
|
||||
}
|
||||
|
||||
void * realloc(void * ptr, size_t size)
|
||||
{
|
||||
void * pTemp;
|
||||
|
||||
if(size == 0)
|
||||
__free(ptr);
|
||||
|
||||
if(ptr == 0)
|
||||
return __malloc(size);
|
||||
|
||||
pTemp = __realloc(ptr, size);
|
||||
|
||||
if(pTemp == 0)
|
||||
errno = ENOMEM;
|
||||
|
||||
return (pTemp);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue