File:  [MW Coherent from dump] / coherent / b / lib / libc / gen / old / notmem.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent


/*
 * Tell if this block of memory is in the malloc area
 */

#include <stdio.h>
#include <malloc.h>

extern  struct mblock	*_a_scanp;	/* first arena */

notmem(cp)
char *cp;
{
	register unsigned len;
	register struct mblock *ap, *ptr;
	
	if(cp == NULL || (ptr = _a_scanp) == NULL ||
	  !((ap = cp - sizeof(unsigned))->blksize))
		return(1);	/* bullshit address */

	do {
		if(ptr == ap)
			return(0);	/* obviously good */

		if(len = ptr->blksize)
			ptr = realsize(len) + adr(ptr);
		else
			ptr = ptr->uval.next;
	} while (ptr != _a_scanp);

	return(1);	/* not found is bad address */
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.