|
|
1.1 ! root 1: # include <sccs.h> ! 2: ! 3: SCCSID(@(#)xfree.c 8.1 12/31/84) ! 4: ! 5: /* ! 6: ** XFREE -- free memory only if dynamically allocated. ! 7: ** ! 8: ** This acts just like "free", except that it does nothing ! 9: ** if the area handed to it hasn't been dynamically allocated. ! 10: ** ! 11: ** Parameters: ! 12: ** p -- a pointer to the area to free. ! 13: ** ! 14: ** Returns: ! 15: ** none. ! 16: ** ! 17: ** Side Effects: ! 18: ** Free memory queue is changed. ! 19: ** ! 20: ** WARNING: ! 21: ** This routine depends on the implementation of malloc ! 22: ** in C; it may have to be changed on other systems. ! 23: */ ! 24: ! 25: xfree(p) ! 26: char *p; ! 27: { ! 28: extern char end[]; ! 29: ! 30: if (p >= end && p < (char *) &p) ! 31: free(p); ! 32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.