|
|
1.1 root 1:
2: /*
3: * Tell if this block of memory is in the malloc area
4: */
5:
6: #include <stdio.h>
7: #include <malloc.h>
8:
9: extern struct mblock *_a_scanp; /* first arena */
10:
11: notmem(cp)
12: char *cp;
13: {
14: register unsigned len;
15: register struct mblock *ap, *ptr;
16:
17: if(cp == NULL || (ptr = _a_scanp) == NULL ||
18: !((ap = cp - sizeof(unsigned))->blksize))
19: return(1); /* bullshit address */
20:
21: do {
22: if(ptr == ap)
23: return(0); /* obviously good */
24:
25: if(len = ptr->blksize)
26: ptr = realsize(len) + adr(ptr);
27: else
28: ptr = ptr->uval.next;
29: } while (ptr != _a_scanp);
30:
31: return(1); /* not found is bad address */
32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.