3 /* void * realloc( void *, size_t )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
15 /* TODO: Primitive placeholder. Improve. */
17 void * realloc( void * ptr, size_t size )
22 return malloc( size );
26 struct _PDCLIB_memnode_t * baseptr = (struct _PDCLIB_memnode_t *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) );
27 if ( baseptr->size >= size )
29 /* Current memnode is large enough; nothing to do. */
34 /* Get larger memnode and copy over contents. */
35 if ( ( newptr = malloc( size ) ) == NULL )
39 memcpy( newptr, ptr, baseptr->size );
49 #include <_PDCLIB_test.h>
53 /* tests covered in malloc test driver */