/* * realloc() -- re-size the block of storage pointed to by 'root' * to 'new_size' (in bytes). The old values are copied * into the new space, up to the smaller of the two. * * Author: Scott Henry, 22 Feb 88 */ #ifndef NULL #define NULL ((void *)0) #endif struct mem { struct mem *next; long size; }; void * realloc( root, new_size) register unsigned char *root; register unsigned int new_size; { extern unsigned char *malloc(); register struct mem *mp; register unsigned char *ptr; register long old_size; register unsigned int i; if (root == NULL) { return( new_size > 0 ? malloc( new_size) : NULL); } if (new_size <= 0) { free( root); return (NULL); } #ifdef AZTEC_C mp = (struct mem *)root -1; old_size = mp->size; if ((ptr = malloc( new_size)) == NULL) { return NULL; } for (i=0; i