/* new memory functions */ #define LOG_MISC 32 #define MEMTBLSIZE 6666 #undef DEBUG #include extern int serv; unsigned memused=0; #ifdef DEBUG struct { void *ptr; int size; char file[20]; int line; } memtbl[MEMTBLSIZE]; #endif /* initialize the memory structure */ void init_mem() { #ifdef DEBUG int i; for (i=0; i60) { sofar[strlen(sofar)-1]=0; tprintf(z,"%s\n",sofar); strcpy(sofar," "); } } if (sofar[0]) { sofar[strlen(sofar)-1]=0; tprintf(z,"%s\n",sofar); } } } tprintf(z,"--- End of debug memory list.\n"); #else tprintf(z,"Compiled without extensive memory debugging (sorry).\n"); #endif } void *n_malloc(size,file,line) int size,line; char *file; { void *x; int i; #ifdef DEBUG x=(void *)malloc(size); if (x==NULL) { log(LOG_MISC,"*** FAILED MALLOC %s (%d)",file,line); return NULL; } for (i=0; (i