|
|
1.1 ! root 1: ! 2: ! 3: memok() General Function memok() ! 4: ! 5: ! 6: ! 7: ! 8: Test if the arena is corrupted ! 9: ! 10: mmeemmookk(); ! 11: ! 12: The library function memok checks to see if the area has been ! 13: corrupted. It returns one if the arena is sound, and zero if it ! 14: has been corrupted. ! 15: ! 16: ***** Example ***** ! 17: ! 18: The following example purposely corrupts the arena, to ! 19: demonstrate memok. Please note that this is not a recommended ! 20: programming practice. ! 21: ! 22: ! 23: extern char *malloc(); ! 24: main() ! 25: { ! 26: char *p; ! 27: ! 28: ! 29: ! 30: p = malloc(2); /* get 2 bytes of memory */ ! 31: printf("Arena is %s\n", memok() ? "OK" : "bad"); ! 32: strcpy(p, "too long"); /* clobber memory */ ! 33: printf("Arena is %s\n", memok() ? "OK" : "bad"); ! 34: } ! 35: ! 36: ! 37: ***** See Also ***** ! 38: ! 39: arena, calloc(), general functions, malloc(), realloc() ! 40: ! 41: ! 42: ! 43: ! 44: ! 45: ! 46: ! 47: ! 48: ! 49: ! 50: ! 51: ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.