extern void _VDBG_free(void *ptr,char *file,long line){ if(ptr){ ptr-=HEAD_ALIGN; _ripremove(ptr); free(ptr); } }
extern void _VDBG_free(void *ptr){ if(ptr){ ptr=(void *)(((char *)ptr)-HEAD_ALIGN); _ripremove(ptr); free(ptr); } }
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){ bytes+=HEAD_ALIGN; if(ptr){ ptr-=HEAD_ALIGN; _ripremove(ptr); ptr=realloc(ptr,bytes); }else{ ptr=malloc(bytes); memset(ptr,0,bytes); } return _insert(ptr,bytes,file,line); }
void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){ if(bytes<=0) fprintf(stderr,"bad malloc request (%ld bytes) from %s:%ld\n",bytes,file,line); bytes+=HEAD_ALIGN; if(ptr){ ptr-=HEAD_ALIGN; _ripremove(ptr); ptr=realloc(ptr,bytes); }else{ ptr=malloc(bytes); memset(ptr,0,bytes); } return _insert(ptr,bytes,file,line); }