/* Change size of area pointed to by 'ptr' to 'size'. If 'ptr' is NULL, then its a malloc(). If 'size' is 0, then its a free(). 'ptr' must be NULL or a pointer to a non-freed area previously returned by simple_realloc() or simple_malloc().  */
static void* simple_realloc(void *ptr, unsigned long size)
/* Change size of area pointed to by 'ptr' to 'size'. If 'ptr' is NULL, then its a malloc(). If 'size' is 0, then its a free(). 'ptr' must be NULL or a pointer to a non-freed area previously returned by simple_realloc() or simple_malloc().  */
static void* simple_realloc(void *ptr, unsigned long size)
{
	struct alloc_info *p;
	void *new;
	if (size == 0) {
		simple_free(ptr);
		return NULL;
	}
	if (ptr == NULL)
		return simple_malloc(size);
	p = simple_find_entry(ptr);
	if (p == NULL)
		return NULL;
	if (size <= p->size)
		return ptr;
	new = simple_malloc(size);
	memcpy(new, ptr, p->size);
	simple_free(ptr);
	return new;
}