-/* PDPC code - assumes size_t of memory chunk at offset -4.
-{
- char * newptr;
- size_t oldsize;
-
- if ( ( newptr = malloc(size) ) != NULL )
- {
- if ( ptr != NULL )
- {
- // reading size information from hidden chunk header
- oldsize = * (size_t *) ( (char *) ptr - 4 );
- // correctly handle *down*sizing as well as *up*sizing
- memcpy( newptr, ptr, ( oldsize < size ) ? oldsize : size );
- free( ptr );
- }
- }
- return ( newptr );
-}
+ This file is part of the Public Domain C Library (PDCLib).
+ Permission is granted to use, modify, and / or redistribute at will.