5 /* void * realloc( void *, size_t )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
17 /* TODO: Primitive placeholder. Improve. */
19 void * realloc( void * ptr, size_t size )
21 struct _PDCLIB_memnode_t * baseptr = (struct _PDCLIB_memnode_t *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) );
22 if ( baseptr->size >= size )
28 void * newptr = malloc( size );
29 memcpy( newptr, ptr, baseptr->size );
39 #include <_PDCLIB_test.h>
44 /* tests covered in malloc test driver */