
/*
*/
#include "V_M_UC.h"
#include "sys_malloc.h"
/*
* Our debug version returns p if the operation succeeds (to the best  of  our
* ability  to determine), and 0 if it fails.  Different libraries handle this
* in different (and often flakey) ways, so you may need to do  some  tweaking
* here.
*/
void* d_free(p,m)
	void* p;
	char* m;
{	void* r=p;
	int   e=errno;
	long  x = (long)p;	/* Long value for debug messages */
	Fenter("d_free");
	V7M "free(%08X,%08X)",x,m D;
	if (!m) m = unknown;
	errno = 0;
	if (p) {
		free(p);
		if (errno) {
			e = errno;
			V2M "free(%lX) %s set errno to %d=%s=%s]",x,m,Errinfo D;
			r = 0;
		}
	} else {
		e = errno = EFAULT;
		V2M "d_free(0) %s set errno to %d=%s=%s]",m,Errinfo D;
		r = 0;
	}
	if (errno)
		V2M "free(%lx) %s failed [Err %d=%s=%s]",x,m,Errinfo D;
	V6M "free(%08X) %s [Err %d=%s=%s]",x,m,Errinfo D;
	Fexit;
	errno = e;
	return r;
}
