File:  [Research Unix] / researchv10no / cmd / mk / src / alloc.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

#include	"libc.h"

static int goo;		/* so no empty object on cray */

#ifndef	CRAY

#define	A(x)	((((long)x)+sizeof(long)-1)&~(sizeof(long)-1))

char *next;
int nleft;

char *
malloc(n)
{
	extern char *sbrk();
	char *s;

	n = A(n);
	if(n > nleft){
		next = sbrk(nleft = A(32000));
		if(next == (char *)-1){
			perror("mk: sbrk");
			Exit();
		}
	}
	s = next;
	next += n;
	nleft -= n;
	return(s);
}

free(s)
	char *s;
{
}

char *
realloc(s, n)
	char *s;
	unsigned n;
{
	char *r;

	r = malloc(n);
	memcpy(r, s, n);
	return(r);
}

#endif

unix.superglobalmegacorp.com

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